Commit 853488ee by Philip Kelley Committed by Vicent Marti

Fix git__strncasecmp

parent b421decc
...@@ -199,17 +199,15 @@ int git__strncmp(const char *a, const char *b, size_t sz) ...@@ -199,17 +199,15 @@ int git__strncmp(const char *a, const char *b, size_t sz)
int git__strncasecmp(const char *a, const char *b, size_t sz) int git__strncasecmp(const char *a, const char *b, size_t sz)
{ {
int al = 0, bl = 0; int al, bl;
while (sz && *a && *b) { do {
al = (unsigned char)tolower(*a); al = (unsigned char)tolower(*a);
bl = (unsigned char)tolower(*b); bl = (unsigned char)tolower(*b);
if (al != bl) ++a, ++b;
break; } while (--sz && al && al == bl);
--sz, ++a, ++b;
}
return !sz ? 0 : al - bl; return al - bl;
} }
void git__strntolower(char *str, size_t len) void git__strntolower(char *str, size_t len)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment