{"thread":{"id":"58585","subject":"[PATCH] dir: use fspathncmp() in pl_hashmap_cmp()","startedAt":"2022-10-08T11:06:14Z","lastAt":"2022-10-11T00:19:22Z","messageCount":2,"participants":["René Scharfe","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"464425","messageId":"cb6ffcdb-d719-7928-96b8-e46482dd141f@web.de","threadId":"58585","inReplyTo":null,"subject":"[PATCH] dir: use fspathncmp() in pl_hashmap_cmp()","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2022-10-08T11:05:43Z","receivedAt":"2022-10-08T11:06:14Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"From: Jeff King <peff@peff.net>\n\nCall fspathncmp() instead of open-coding it.  This shortens the code and\nmakes it less repetitive.\n\nSigned-off-by: René Scharfe <l.s.r@web.de>\n---\nFrom https://lore.kernel.org/git/YSv1XZJvYdYj1JtP@coredump.intra.peff.net/\n\n dir.c | 4 +---\n 1 file changed, 1 insertion(+), 3 deletions(-)\n\ndiff --git a/dir.c b/dir.c\nindex 7d56d68355..28f4c6895b 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -669,9 +669,7 @@ int pl_hashmap_cmp(const void *cmp_data UNUSED,\n \t\t\t ? ee1->patternlen\n \t\t\t : ee2->patternlen;\n\n-\tif (ignore_case)\n-\t\treturn strncasecmp(ee1->pattern, ee2->pattern, min_len);\n-\treturn strncmp(ee1->pattern, ee2->pattern, min_len);\n+\treturn fspathncmp(ee1->pattern, ee2->pattern, min_len);\n }\n\n static char *dup_and_filter_pattern(const char *pattern)\n--\n2.38.0\n"},{"id":"464550","messageId":"Y0S2hCA/xoV8RWTt@coredump.intra.peff.net","threadId":"58585","inReplyTo":"cb6ffcdb-d719-7928-96b8-e46482dd141f@web.de","subject":"Re: [PATCH] dir: use fspathncmp() in pl_hashmap_cmp()","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2022-10-11T00:19:16Z","receivedAt":"2022-10-11T00:19:22Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Oct 08, 2022 at 01:05:43PM +0200, René Scharfe wrote:\n\n> From: Jeff King <peff@peff.net>\n> \n> Call fspathncmp() instead of open-coding it.  This shortens the code and\n> makes it less repetitive.\n> \n> Signed-off-by: René Scharfe <l.s.r@web.de>\n> ---\n> From https://lore.kernel.org/git/YSv1XZJvYdYj1JtP@coredump.intra.peff.net/\n\nThat's an old one. :) Thanks for hanging on to it.\n\n> diff --git a/dir.c b/dir.c\n> index 7d56d68355..28f4c6895b 100644\n> --- a/dir.c\n> +++ b/dir.c\n> @@ -669,9 +669,7 @@ int pl_hashmap_cmp(const void *cmp_data UNUSED,\n>  \t\t\t ? ee1->patternlen\n>  \t\t\t : ee2->patternlen;\n> \n> -\tif (ignore_case)\n> -\t\treturn strncasecmp(ee1->pattern, ee2->pattern, min_len);\n> -\treturn strncmp(ee1->pattern, ee2->pattern, min_len);\n> +\treturn fspathncmp(ee1->pattern, ee2->pattern, min_len);\n>  }\n\nUnlike the other one discussed in that thread, where there is a shadow\nignore_case, we decided that this one is a true simplification.\n\n-Peff\n"}]}