diff options
Diffstat (limited to 'sys/libkern/strcasecmp.c')
-rw-r--r-- | sys/libkern/strcasecmp.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/libkern/strcasecmp.c b/sys/libkern/strcasecmp.c index 8e65827..a058654 100644 --- a/sys/libkern/strcasecmp.c +++ b/sys/libkern/strcasecmp.c @@ -43,11 +43,12 @@ strcasecmp(const char *s1, const char *s2) { const u_char *us1 = (const u_char *)s1, *us2 = (const u_char *)s2; - while (tolower(*us1) == tolower(*us2++)) { + while (tolower(*us1) == tolower(*us2)) { if (*us1++ == '\0') return (0); + us2++; } - return (tolower(*us1) - tolower(*--us2)); + return (tolower(*us1) - tolower(*us2)); } int @@ -59,10 +60,11 @@ strncasecmp(const char *s1, const char *s2, size_t n) const u_char *us2 = (const u_char *)s2; do { - if (tolower(*us1) != tolower(*us2++)) - return (tolower(*us1) - tolower(*--us2)); + if (tolower(*us1) != tolower(*us2)) + return (tolower(*us1) - tolower(*us2)); if (*us1++ == '\0') break; + us2++; } while (--n != 0); } return (0); |