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:
authorJunio C Hamano <gitster@pobox.com>2022-08-03 23:36:09 +0300
committerJunio C Hamano <gitster@pobox.com>2022-08-03 23:36:09 +0300
commit4e0d160bbc88c3486ff7ccae179e4730aab5dd28 (patch)
tree97786123608c06c4f2758c8c0396675e345d1201 /packfile.c
parent87098a047be46ee69da056336109eee2139c1398 (diff)
parent0f1eb7d6e976c64c0016d4355200660ce2fdf1ec (diff)
Merge branch 'rs/mergesort'
Make our mergesort implementation type-safe. * rs/mergesort: mergesort: remove llist_mergesort() packfile: use DEFINE_LIST_SORT fetch-pack: use DEFINE_LIST_SORT commit: use DEFINE_LIST_SORT blame: use DEFINE_LIST_SORT test-mergesort: use DEFINE_LIST_SORT test-mergesort: use DEFINE_LIST_SORT_DEBUG mergesort: add macros for typed sort of linked lists mergesort: tighten merge loop mergesort: unify ranks loops
Diffstat (limited to 'packfile.c')
-rw-r--r--packfile.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/packfile.c b/packfile.c
index ed69fe457b..6b0eb9048e 100644
--- a/packfile.c
+++ b/packfile.c
@@ -941,20 +941,10 @@ unsigned long repo_approximate_object_count(struct repository *r)
return r->objects->approximate_object_count;
}
-static void *get_next_packed_git(const void *p)
-{
- return ((const struct packed_git *)p)->next;
-}
-
-static void set_next_packed_git(void *p, void *next)
-{
- ((struct packed_git *)p)->next = next;
-}
+DEFINE_LIST_SORT(static, sort_packs, struct packed_git, next);
-static int sort_pack(const void *a_, const void *b_)
+static int sort_pack(const struct packed_git *a, const struct packed_git *b)
{
- const struct packed_git *a = a_;
- const struct packed_git *b = b_;
int st;
/*
@@ -981,9 +971,7 @@ static int sort_pack(const void *a_, const void *b_)
static void rearrange_packed_git(struct repository *r)
{
- r->objects->packed_git = llist_mergesort(
- r->objects->packed_git, get_next_packed_git,
- set_next_packed_git, sort_pack);
+ sort_packs(&r->objects->packed_git, sort_pack);
}
static void prepare_packed_git_mru(struct repository *r)