From: Jeremiah Mahler Date: Wed, 18 Jun 2014 18:45:15 GMT Subject: [PATCH v3 3/5] unpack-trees.c: remove name_compare() function Message-ID: <1403117117-10384-4-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 --- 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. unpack-trees.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/unpack-trees.c b/unpack-trees.c index 4a9cdf2..c4a97ca 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -629,17 +629,6 @@ static int unpack_failed(struct unpack_trees_options *o, const char *message) return -1; } -/* NEEDSWORK: give this a better name and share with tree-walk.c */ -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); -} - /* * The tree traversal is looking at name p. If we have a matching entry, * return it. If name p is a directory in the index, do not return -- 2.0.0