From 442ca54391e96c7bcb7d886b28f57300253a4c17 Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Thu, 23 Apr 2009 23:37:42 +0000 Subject: [PATCH] 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 --- src/lib/krb5/krb/princ_comp.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) 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; } -- 2.26.2