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

[PATCH v3 2/5] tree-walk.c: remove name_compare() function

From
Jeremiah Mahler <jmmahler@gmail.com>
Date
Jun 18, 2014, 18:45 UTC
Message-ID
<1403117117-10384-3-git-send-email-jmmahler@gmail.com>
In-Reply-To
<1403117117-10384-1-git-send-email-jmmahler@gmail.com>

Remove the duplicate name_compare() function and use the one provided by read-cache.c.

Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
---
Notes:
    There is one small difference between the old function and the new one.
    The old one returned -N and +N whereas the new one returns -1 and +1.
    However, there is no place where the magnitude was needed, so this
    change will not alter its behavior.
 tree-walk.c | 10 ----------
 1 file changed, 10 deletions(-)
diff --git a/tree-walk.c b/tree-walk.c
index 4dc86c7..5dd9a71 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -144,16 +144,6 @@ struct tree_desc_x {
 	struct tree_desc_skip *skip;
 };
 
-static int name_compare(const char *a, int a_len,
-			const char *b, int b_len)
-{
-	int len = (a_len < b_len) ? a_len : b_len;
-	int cmp = memcmp(a, b, len);
-	if (cmp)
-		return cmp;
-	return (a_len - b_len);
-}
-
 static int check_entry_match(const char *a, int a_len, const char *b, int b_len)
 {
 	/*
-- 
2.0.0
Previous: Jonathan NiederNext: Jonathan Nieder
Message 4 of 15 in “cleanup duplicate name_compare() functions”
  1. 0/5 cleanup duplicate name_compare() functionsJeremiah Mahler, Jun 18, 2014
  2. 1/5 cache: rename cache_name_compare() to name_compare()Jeremiah Mahler, Jun 18, 2014
  3. Jonathan NiederJun 18, 2014
  4. 2/5 tree-walk.c: remove name_compare() functionJeremiah Mahler, Jun 18, 2014
  5. Jonathan NiederJun 18, 2014
  6. Jeremiah MahlerJun 19, 2014
  7. 3/5 unpack-trees.c: remove name_compare() functionJeremiah Mahler, Jun 18, 2014
  8. Jonathan NiederJun 18, 2014
  9. 4/5 dir.c: rename to name_compare()Jeremiah Mahler, Jun 18, 2014
  10. Jonathan NiederJun 18, 2014
  11. 5/5 name-hash.c: rename to name_compare()Jeremiah Mahler, Jun 18, 2014
  12. Jonathan NiederJun 18, 2014
  13. Jonathan NiederJun 18, 2014
  14. Jeremiah MahlerJun 19, 2014
  15. Jeff KingJun 19, 2014

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.