From: Greg Hudson Date: Thu, 23 Apr 2009 23:37:42 +0000 (+0000) Subject: In krb5_principal_compare_flags, improve clarity slightly by using a X-Git-Tag: krb5-1.8-alpha1~529 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=442ca54391e96c7bcb7d886b28f57300253a4c17;p=krb5.git In krb5_principal_compare_flags, improve clarity slightly by using a boolean temporary instead of an ordering temporary in the loop over the elements, since we only care about the boolean result. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22277 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/krb/princ_comp.c b/src/lib/krb5/krb/princ_comp.c index 46e00e48d..367c11e3d 100644 --- a/src/lib/krb5/krb/princ_comp.c +++ b/src/lib/krb5/krb/princ_comp.c @@ -112,21 +112,20 @@ krb5_principal_compare_flags(krb5_context context, goto out; for (i = 0; i < (int) nelem; i++) { - register const krb5_data *p1 = krb5_princ_component(context, princ1, i); - register const krb5_data *p2 = krb5_princ_component(context, princ2, i); - int cmp; + const krb5_data *p1 = krb5_princ_component(context, princ1, i); + const krb5_data *p2 = krb5_princ_component(context, princ2, i); + krb5_boolean eq; if (casefold) { if (utf8) - cmp = krb5int_utf8_normcmp(p1, p2, KRB5_UTF8_CASEFOLD); + eq = (krb5int_utf8_normcmp(p1, p2, KRB5_UTF8_CASEFOLD) == 0); else - cmp = p1->length == p2->length ? - strncasecmp(p1->data, p2->data, p2->length) : - p1->length - p2->length; + eq = (p1->length == p2->length + && strncasecmp(p1->data, p2->data, p2->length) == 0); } else - cmp = !data_eq(*p1, *p2); + eq = data_eq(*p1, *p2); - if (cmp != 0) + if (!eq) goto out; }