From: Dmitry S. Dolzhenko Date: Mon, 3 Mar 2014 22:31:51 +0000 (+0400) Subject: cache-tree.c: use ALLOC_GROW() in find_subtree() X-Git-Tag: v2.0.0-rc0~97^2~11 X-Git-Url: http://git.bitbasher.net/?a=commitdiff_plain;h=bcc7a03285a2f0173a2d8afcc951c6dc0fc4eda8;p=git.git cache-tree.c: use ALLOC_GROW() in find_subtree() Signed-off-by: Dmitry S. Dolzhenko Signed-off-by: Junio C Hamano --- diff --git a/cache-tree.c b/cache-tree.c index 0bbec43216..30149d1c42 100644 --- a/cache-tree.c +++ b/cache-tree.c @@ -75,11 +75,7 @@ static struct cache_tree_sub *find_subtree(struct cache_tree *it, return NULL; pos = -pos-1; - if (it->subtree_alloc <= it->subtree_nr) { - it->subtree_alloc = alloc_nr(it->subtree_alloc); - it->down = xrealloc(it->down, it->subtree_alloc * - sizeof(*it->down)); - } + ALLOC_GROW(it->down, it->subtree_nr + 1, it->subtree_alloc); it->subtree_nr++; down = xmalloc(sizeof(*down) + pathlen + 1);