From: Keith Packard Date: Wed, 5 Mar 2003 06:09:36 +0000 (+0000) Subject: optimize string compares even more X-Git-Tag: fc-2_1_92~25 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=d93fb00e8dd757fbdaafd4dd36509c33b7827eb5;p=fontconfig.git optimize string compares even more --- diff --git a/src/fcstr.c b/src/fcstr.c index 8072a18..8c13696 100644 --- a/src/fcstr.c +++ b/src/fcstr.c @@ -72,15 +72,8 @@ FcStrCmpIgnoreCase (const FcChar8 *s1, const FcChar8 *s2) { c1 = *s1++; c2 = *s2++; - if (!c1) + if (!c1 || (c1 != c2 && (c1 = FcToLower(c1)) != (c2 = FcToLower(c2)))) break; - if (c1 != c2) - { - c1 = FcToLower (c1); - c2 = FcToLower (c2); - if (c1 != c2) - break; - } } return (int) c1 - (int) c2; } @@ -98,11 +91,7 @@ FcStrCmpIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2) do c2 = *s2++; while (c2 == ' '); - if (!c1 || !c2) - break; - c1 = FcToLower (c1); - c2 = FcToLower (c2); - if (c1 != c2) + if (!c1 || (c1 != c2 && (c1 = FcToLower(c1)) != (c2 = FcToLower(c2)))) break; } return (int) c1 - (int) c2; @@ -119,9 +108,7 @@ FcStrCmp (const FcChar8 *s1, const FcChar8 *s2) { c1 = *s1++; c2 = *s2++; - if (!c1 || !c2) - break; - if (c1 != c2) + if (!c1 || c1 != c2) break; } return (int) c1 - (int) c2;