builtin/branch.c: Use ALLOC_GROW instead of alloc_nr and xrealloc.
authorThiago Farina <tfransosi@gmail.com>
Tue, 14 Dec 2010 01:59:55 +0000 (23:59 -0200)
committerJunio C Hamano <gitster@pobox.com>
Sun, 19 Dec 2010 18:43:53 +0000 (10:43 -0800)
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/branch.c

index 0cad20bb5a8bd0054761861aada7f1077260dbd5..9e546e4a83d07dd6dd4d4b0cb7d23a02c82747fb 100644 (file)
@@ -313,12 +313,7 @@ static int append_ref(const char *refname, const unsigned char *sha1, int flags,
                                           (struct object *)commit, refname);
        }
 
-       /* Resize buffer */
-       if (ref_list->index >= ref_list->alloc) {
-               ref_list->alloc = alloc_nr(ref_list->alloc);
-               ref_list->list = xrealloc(ref_list->list,
-                               ref_list->alloc * sizeof(struct ref_item));
-       }
+       ALLOC_GROW(ref_list->list, ref_list->index + 1, ref_list->alloc);
 
        /* Record the new item */
        newitem = &(ref_list->list[ref_list->index++]);