Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Kelley <phkelley@hotmail.com>2013-01-03 17:45:09 +0400
committerPhilip Kelley <phkelley@hotmail.com>2013-01-03 17:45:09 +0400
commit0db4cd04ef263d473219152df996b1cb2c4f52aa (patch)
tree33a3d1d3d9e3b0565c15eff8551a2296145dfbe1 /src/util.c
parent922dd9788cfec2ec4727e1b264a2ad6a7f4849ba (diff)
Fix git__strncasecmp
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/util.c b/src/util.c
index 059e55dd7..ba849aa1a 100644
--- a/src/util.c
+++ b/src/util.c
@@ -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 al = 0, bl = 0;
+ int al, bl;
- while (sz && *a && *b) {
+ do {
al = (unsigned char)tolower(*a);
bl = (unsigned char)tolower(*b);
- if (al != bl)
- break;
- --sz, ++a, ++b;
- }
+ ++a, ++b;
+ } while (--sz && al && al == bl);
- return !sz ? 0 : al - bl;
+ return al - bl;
}
void git__strntolower(char *str, size_t len)