bundle.c: use ALLOC_GROW() in add_to_ref_list()
authorDmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru>
Mon, 3 Mar 2014 22:31:50 +0000 (02:31 +0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 3 Mar 2014 22:44:48 +0000 (14:44 -0800)
Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
bundle.c
index e99065ce425ad6e816d946626ef83075ab70bf85..1388a3e6fdf352fe670e4236f305c1b1e97b74f2 100644 (file)
--- a/bundle.c
+++ b/bundle.c
@@ -14,11 +14,7 @@ static const char bundle_signature[] = "# v2 git bundle\n";
 static void add_to_ref_list(const unsigned char *sha1, const char *name,
                struct ref_list *list)
 {
-       if (list->nr + 1 >= list->alloc) {
-               list->alloc = alloc_nr(list->nr + 1);
-               list->list = xrealloc(list->list,
-                               list->alloc * sizeof(list->list[0]));
-       }
+       ALLOC_GROW(list->list, list->nr + 1, list->alloc);
        memcpy(list->list[list->nr].sha1, sha1, 20);
        list->list[list->nr].name = xstrdup(name);
        list->nr++;