cache-tree.c: use ALLOC_GROW() in find_subtree()

Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Dmitry S. Dolzhenko 2014-03-04 02:31:51 +04:00 committed by Junio C Hamano
parent 5cbbe13a9f
commit bcc7a03285

View File

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