]> git.ipfire.org Git - thirdparty/git.git/blobdiff - packfile.c
Merge branch 'rs/mergesort'
[thirdparty/git.git] / packfile.c
index ed69fe457b5cc746c3bd82791e92e94f22c3e149..6b0eb9048ecc3e04f3fc839a3d687866a6f0b910 100644 (file)
@@ -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)