From: Dmitry S. Dolzhenko Date: Mon, 03 Mar 2014 22:31:50 GMT Subject: [PATCH v4 02/14] bundle.c: use ALLOC_GROW() in add_to_ref_list() Message-ID: <1393885922-21616-3-git-send-email-dmitrys.dolzhenko@yandex.ru> In-Reply-To: <1393885922-21616-1-git-send-email-dmitrys.dolzhenko@yandex.ru> Signed-off-by: Dmitry S. Dolzhenko --- bundle.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/bundle.c b/bundle.c index e99065c..1388a3e 100644 --- a/bundle.c +++ b/bundle.c @@ -14,11 +14,7 @@ static const char bundle_signature[] = "# v2 git bundle\n"; static void add_to_ref_list(const unsigned char *sha1, const char *name, struct ref_list *list) { - if (list->nr + 1 >= list->alloc) { - list->alloc = alloc_nr(list->nr + 1); - list->list = xrealloc(list->list, - list->alloc * sizeof(list->list[0])); - } + ALLOC_GROW(list->list, list->nr + 1, list->alloc); memcpy(list->list[list->nr].sha1, sha1, 20); list->list[list->nr].name = xstrdup(name); list->nr++; -- 1.8.3.2