Browse Source

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>
maint
Thiago Farina 14 years ago committed by Junio C Hamano
parent
commit
fcbc0d8e82
  1. 7
      builtin/branch.c

7
builtin/branch.c

@ -313,12 +313,7 @@ static int append_ref(const char *refname, const unsigned char *sha1, int flags, @@ -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++]);

Loading…
Cancel
Save