git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] dir: use fspathncmp() in pl_hashmap_cmp()

From
René Scharfe <l.s.r@web.de>
Date
Oct 8, 2022, 11:05 UTC
Message-ID
<cb6ffcdb-d719-7928-96b8-e46482dd141f@web.de>
From: Jeff King <peff@peff.net>

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>
---
From https://lore.kernel.org/git/YSv1XZJvYdYj1JtP@coredump.intra.peff.net/
 dir.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/dir.c b/dir.c
index 7d56d68355..28f4c6895b 100644
--- a/dir.c
+++ b/dir.c
@@ -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
Next: Jeff King
Message 1 of 2 in “dir: use fspathncmp() in pl_hashmap_cmp()”
  1. dir: use fspathncmp() in pl_hashmap_cmp()René Scharfe, Oct 8, 2022
  2. Jeff KingOct 11, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.