dir: use fspathncmp() in pl_hashmap_cmp()
PATCH 1/1 dir: use fspathncmp() in pl_hashmap_cmp()
From: Jeff King <[email protected]>
Call fspathncmp() instead of open-coding it. This shortens the code and makes it less repetitive.
Signed-off-by René Scharfe <[email protected]>
---
From https://lore.kernel.org/git/[email protected]/
dir.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
dir.c +1 -3
@@ -669,9 +669,7 @@ int pl_hashmap_cmp(const void *cmp_data UNUSED, ? 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)
--
2.38.0
Quoted 8 lines · René Scharfe
From: Jeff King <[email protected]>
Call
fspathncmp()instead of open-coding it. This shortens the code and makes it less repetitive.Signed-off-by René Scharfe <[email protected]>
That's an old one. :) Thanks for hanging on to it.
dir.c int pl_hashmap_cmp(const void *cmp_data UNUSED, · line 673
Quoted 13 lines
dir.c +1
-3@@ -669,9 +669,7 @@ int pl_hashmap_cmp(const void *cmp_data UNUSED, ? 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); }
Unlike the other one discussed in that thread, where there is a shadow ignore_case, we decided that this one is a true simplification.
-Peff