bundle.c: use ALLOC_GROW() in add_to_ref_list()
Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Dmitry S. Dolzhenko committed
Mar 4, 2014 at 02:31 UTC
5cbbe13a9f16e7ddebd186dbf1dddb16185b968f
1 file changed
+1
-5
bundle.c
+1
-5
@@ -14,11 +14,7 @@ static const char bundle_signature[] = "# v2 git bundle\n";
14
static void add_to_ref_list(const unsigned char *sha1, const char *name,
15
struct ref_list *list)
16
{
17
- if (list->nr + 1 >= list->alloc) {
18
- list->alloc = alloc_nr(list->nr + 1);
19
- list->list = xrealloc(list->list,
20
- list->alloc * sizeof(list->list[0]));
21
- }
17
+ ALLOC_GROW(list->list, list->nr + 1, list->alloc);
18
memcpy(list->list[list->nr].sha1, sha1, 20);
19
list->list[list->nr].name = xstrdup(name);
20
list->nr++;