From: Thiago Farina Date: Tue, 14 Dec 2010 01:59:55 +0000 (-0200) Subject: builtin/branch.c: Use ALLOC_GROW instead of alloc_nr and xrealloc. X-Git-Tag: v1.7.4-rc0~26 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=fcbc0d8e8216d7b6235eccf9f3b556455ad3be3d;p=git.git builtin/branch.c: Use ALLOC_GROW instead of alloc_nr and xrealloc. Signed-off-by: Thiago Farina Signed-off-by: Junio C Hamano --- diff --git a/builtin/branch.c b/builtin/branch.c index 0cad20bb5..9e546e4a8 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -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++]);