diff options
Diffstat (limited to 'main/glib/strcasecmp.c')
-rw-r--r-- | main/glib/strcasecmp.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/main/glib/strcasecmp.c b/main/glib/strcasecmp.c index 12610f5..f149158 100644 --- a/main/glib/strcasecmp.c +++ b/main/glib/strcasecmp.c @@ -1,6 +1,6 @@ /* * Copyright (c) 1987, 1993 - * The Regents of the University of California. All rights reserved. + * The Regents of the University of California. All rights reserved. * * Copyright (c) 2011 The FreeBSD Foundation * All rights reserved. @@ -38,30 +38,33 @@ int strcasecmp(const char *s1, const char *s2) { - const unsigned char - *us1 = (const unsigned char *)s1, - *us2 = (const unsigned char *)s2; + const unsigned char + *us1 = (const unsigned char *)s1, + *us2 = (const unsigned char *)s2; - while (tolower(*us1) == tolower(*us2++)) - if (*us1++ == '\0') - return (0); - return (tolower(*us1) - tolower(*--us2)); + while(tolower(*us1) == tolower(*us2++)) + if(*us1++ == '\0') { + return (0); + } + return (tolower(*us1) - tolower(*--us2)); } int strncasecmp(const char *s1, const char *s2, size_t n) { - if (n != 0) { - const unsigned char - *us1 = (const unsigned char *)s1, - *us2 = (const unsigned char *)s2; + if(n != 0) { + const unsigned char + *us1 = (const unsigned char *)s1, + *us2 = (const unsigned char *)s2; - do { - if (tolower(*us1) != tolower(*us2++)) - return (tolower(*us1) - tolower(*--us2)); - if (*us1++ == '\0') - break; - } while (--n != 0); - } - return (0); + do { + if(tolower(*us1) != tolower(*us2++)) { + return (tolower(*us1) - tolower(*--us2)); + } + if(*us1++ == '\0') { + break; + } + } while(--n != 0); + } + return (0); } |