]> git.ipfire.org Git - thirdparty/git.git/commitdiff
dir: use fspathncmp() in pl_hashmap_cmp()
authorJeff King <peff@peff.net>
Sat, 8 Oct 2022 11:05:43 +0000 (13:05 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sun, 9 Oct 2022 05:09:03 +0000 (22:09 -0700)
Call fspathncmp() instead of open-coding it.  This shortens the code and
makes it less repetitive.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
dir.c

diff --git a/dir.c b/dir.c
index d7cfb08e441825f421f91a982063e00be4168c71..7500ff1622e39cdb1f47ddd77dcd0713bfd0d32d 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -669,9 +669,7 @@ int pl_hashmap_cmp(const void *unused_cmp_data,
                         ? ee1->patternlen
                         : ee2->patternlen;
 
-       if (ignore_case)
-               return strncasecmp(ee1->pattern, ee2->pattern, min_len);
-       return strncmp(ee1->pattern, ee2->pattern, min_len);
+       return fspathncmp(ee1->pattern, ee2->pattern, min_len);
 }
 
 static char *dup_and_filter_pattern(const char *pattern)