From: Greg Hudson Date: Mon, 15 Aug 2011 20:29:07 +0000 (+0000) Subject: Make data_eq_string work with const strings X-Git-Tag: krb5-1.10-alpha1~274 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=66e22f21679a4853ceebf67e12e9629a4826b4f4;p=krb5.git Make data_eq_string work with const strings git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25101 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/include/k5-int.h b/src/include/k5-int.h index d506e7a45..17a0abe45 100644 --- a/src/include/k5-int.h +++ b/src/include/k5-int.h @@ -2720,8 +2720,13 @@ krb5int_build_principal_alloc_va(krb5_context context, static inline int data_eq(krb5_data d1, krb5_data d2) { - return (d1.length == d2.length - && !memcmp(d1.data, d2.data, d1.length)); + return (d1.length == d2.length && !memcmp(d1.data, d2.data, d1.length)); +} + +static inline int +data_eq_string (krb5_data d, const char *s) +{ + return (d.length == strlen(s) && !memcmp(d.data, s, d.length)); } static inline krb5_data @@ -2761,12 +2766,6 @@ alloc_data(krb5_data *data, unsigned int len) return 0; } -static inline int -data_eq_string (krb5_data d, char *s) -{ - return data_eq(d, string2data(s)); -} - static inline int authdata_eq(krb5_authdata a1, krb5_authdata a2) {