Skip to content

Commit fcbc0d8

Browse files
tfarinagitster
authored andcommitted
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>
1 parent 1b97434 commit fcbc0d8

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

builtin/branch.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,12 +313,7 @@ static int append_ref(const char *refname, const unsigned char *sha1, int flags,
313313
(struct object *)commit, refname);
314314
}
315315

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);
322317

323318
/* Record the new item */
324319
newitem = &(ref_list->list[ref_list->index++]);

0 commit comments

Comments
 (0)