builtin/branch.c: Use ALLOC_GROW instead of alloc_nr and xrealloc.
Signed-off-by: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Thiago Farina committed
Dec 13, 2010 at 23:59 UTC
fcbc0d8e8216d7b6235eccf9f3b556455ad3be3d
1 file changed
+1
-6
builtin/branch.c
+1
-6
@@ -313,12 +313,7 @@ static int append_ref(const char *refname, const unsigned char *sha1, int flags,
313
(struct object *)commit, refname);
314
}
315
316
- /* Resize buffer */
317
- if (ref_list->index >= ref_list->alloc) {
318
- ref_list->alloc = alloc_nr(ref_list->alloc);
319
- ref_list->list = xrealloc(ref_list->list,
320
- ref_list->alloc * sizeof(struct ref_item));
321
- }
316
+ ALLOC_GROW(ref_list->list, ref_list->index + 1, ref_list->alloc);
317
318
/* Record the new item */
319
newitem = &(ref_list->list[ref_list->index++]);