From: Dmitry S. Dolzhenko Date: Mon, 03 Mar 2014 22:31:49 GMT Subject: [PATCH v4 01/14] builtin/pack-objects.c: use ALLOC_GROW() in check_pbase_path() Message-ID: <1393885922-21616-2-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 --- builtin/pack-objects.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index c733379..0ffad6f 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -1213,12 +1213,9 @@ static int check_pbase_path(unsigned hash) if (0 <= pos) return 1; pos = -pos - 1; - if (done_pbase_paths_alloc <= done_pbase_paths_num) { - done_pbase_paths_alloc = alloc_nr(done_pbase_paths_alloc); - done_pbase_paths = xrealloc(done_pbase_paths, - done_pbase_paths_alloc * - sizeof(unsigned)); - } + ALLOC_GROW(done_pbase_paths, + done_pbase_paths_num + 1, + done_pbase_paths_alloc); done_pbase_paths_num++; if (pos < done_pbase_paths_num) memmove(done_pbase_paths + pos + 1, -- 1.8.3.2