svn rev #22277: trunk/src/lib/krb5/krb/
ghudson@MIT.EDU
ghudson at MIT.EDU
Thu Apr 23 19:37:43 EDT 2009
http://src.mit.edu/fisheye/changelog/krb5/?cs=22277
Commit By: ghudson
Log Message:
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.
Changed Files:
U trunk/src/lib/krb5/krb/princ_comp.c
Modified: trunk/src/lib/krb5/krb/princ_comp.c
===================================================================
--- trunk/src/lib/krb5/krb/princ_comp.c 2009-04-23 15:15:22 UTC (rev 22276)
+++ trunk/src/lib/krb5/krb/princ_comp.c 2009-04-23 23:37:42 UTC (rev 22277)
@@ -112,21 +112,20 @@
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;
}
More information about the cvs-krb5
mailing list