summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2022-07-16 16:59:59 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-07-17 22:20:39 (GMT)
commit6fc9fec07bcaa6561aff5b485f1ac581f97a2428 (patch)
treefaa2cb218c1fa4664d95175816ad01f9a693df42 /remote.c
parentc0fb5774a6435a46931ec58ac27a5623efba9449 (diff)
downloadgit-6fc9fec07bcaa6561aff5b485f1ac581f97a2428.zip
git-6fc9fec07bcaa6561aff5b485f1ac581f97a2428.tar.gz
git-6fc9fec07bcaa6561aff5b485f1ac581f97a2428.tar.bz2
fetch-pack: use DEFINE_LIST_SORT
Build a static typed ref sorting function using DEFINE_LIST_SORT along with a typed comparison function near its only two callers instead of having an exported version that calls llist_mergesort(). This gets rid of the next pointer accessor functions and their calling overhead at the cost of a slightly increased object text size. Before: __TEXT __DATA __OBJC others dec hex 23231 389 0 113689 137309 2185d fetch-pack.o 29158 80 0 146864 176102 2afe6 remote.o With this patch: __TEXT __DATA __OBJC others dec hex 23591 389 0 117759 141739 229ab fetch-pack.o 29070 80 0 145718 174868 2ab14 remote.o Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c22
1 files changed, 0 insertions, 22 deletions
diff --git a/remote.c b/remote.c
index 42a4e71..07cdd3d 100644
--- a/remote.c
+++ b/remote.c
@@ -10,7 +10,6 @@
#include "dir.h"
#include "tag.h"
#include "string-list.h"
-#include "mergesort.h"
#include "strvec.h"
#include "commit-reach.h"
#include "advice.h"
@@ -1031,27 +1030,6 @@ void free_refs(struct ref *ref)
}
}
-int ref_compare_name(const void *va, const void *vb)
-{
- const struct ref *a = va, *b = vb;
- return strcmp(a->name, b->name);
-}
-
-static void *ref_list_get_next(const void *a)
-{
- return ((const struct ref *)a)->next;
-}
-
-static void ref_list_set_next(void *a, void *next)
-{
- ((struct ref *)a)->next = next;
-}
-
-void sort_ref_list(struct ref **l, int (*cmp)(const void *, const void *))
-{
- *l = llist_mergesort(*l, ref_list_get_next, ref_list_set_next, cmp);
-}
-
int count_refspec_match(const char *pattern,
struct ref *refs,
struct ref **matched_ref)