mirror of
https://github.com/git/git.git
synced 2024-11-24 02:17:02 +08:00
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:
parent
5cbbe13a9f
commit
bcc7a03285
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user