Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2023-04-22 23:17:21 +0300
committerJunio C Hamano <gitster@pobox.com>2023-04-24 22:47:32 +0300
commitaabc5617cdfb29ccf98048b0d99cae2a811df51f (patch)
tree67c5ee64fe359a96c8e4c6aa69e8ad7ced317252 /read-cache.c
parentd1cbe1e6d8a9cab2b4ffe8a17d34db214dce1e49 (diff)
cache,tree: move cmp_cache_name_compare from tree.[ch] to read-cache.c
Since cmp_cache_name_compare() was comparing cache_entry structs, it was associated with the cache rather than with trees. Move the function. As a side effect, we can make cache_name_stage_compare() static as well. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/read-cache.c b/read-cache.c
index 206c003e55..8f00da4bf7 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -567,7 +567,8 @@ int name_compare(const char *name1, size_t len1, const char *name2, size_t len2)
return 0;
}
-int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2)
+static int cache_name_stage_compare(const char *name1, int len1, int stage1,
+ const char *name2, int len2, int stage2)
{
int cmp;
@@ -582,6 +583,16 @@ int cache_name_stage_compare(const char *name1, int len1, int stage1, const char
return 0;
}
+int cmp_cache_name_compare(const void *a_, const void *b_)
+{
+ const struct cache_entry *ce1, *ce2;
+
+ ce1 = *((const struct cache_entry **)a_);
+ ce2 = *((const struct cache_entry **)b_);
+ return cache_name_stage_compare(ce1->name, ce1->ce_namelen, ce_stage(ce1),
+ ce2->name, ce2->ce_namelen, ce_stage(ce2));
+}
+
static int index_name_stage_pos(struct index_state *istate,
const char *name, int namelen,
int stage,