From 913587fca3c699a4a8162ef841e97eefcd2a66af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Goddard=20Rosa?= Date: Fri, 5 Mar 2010 13:43:11 -0800 Subject: [PATCH] --- yaml --- r: 186267 b: refs/heads/master c: a11d2b64e1f2556953120d516241243ea365f0ae h: refs/heads/master i: 186265: 7fe022df0426728afc85f66e8cc9a5cb20cf26a2 186263: b9ff0974fa610b8564928c748e08d28dd6e4d4a4 v: v3 --- [refs] | 2 +- trunk/lib/string.c | 34 +++++++++++++++------------------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/[refs] b/[refs] index 1272d8df6198..06786fc78825 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 8a6e25357d51d6ecf4ee21e9048f0416a085a79c +refs/heads/master: a11d2b64e1f2556953120d516241243ea365f0ae diff --git a/trunk/lib/string.c b/trunk/lib/string.c index a1cdcfcc42d0..0f8624532082 100644 --- a/trunk/lib/string.c +++ b/trunk/lib/string.c @@ -36,25 +36,21 @@ int strnicmp(const char *s1, const char *s2, size_t len) /* Yes, Virginia, it had better be unsigned */ unsigned char c1, c2; - c1 = c2 = 0; - if (len) { - do { - c1 = *s1; - c2 = *s2; - s1++; - s2++; - if (!c1) - break; - if (!c2) - break; - if (c1 == c2) - continue; - c1 = tolower(c1); - c2 = tolower(c2); - if (c1 != c2) - break; - } while (--len); - } + if (!len) + return 0; + + do { + c1 = *s1++; + c2 = *s2++; + if (!c1 || !c2) + break; + if (c1 == c2) + continue; + c1 = tolower(c1); + c2 = tolower(c2); + if (c1 != c2) + break; + } while (--len); return (int)c1 - (int)c2; } EXPORT_SYMBOL(strnicmp);