Skip to content

Commit bcc7a03

Browse files
Dmitry S. Dolzhenkogitster
authored andcommitted
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>
1 parent 5cbbe13 commit bcc7a03

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

cache-tree.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,7 @@ static struct cache_tree_sub *find_subtree(struct cache_tree *it,
7575
return NULL;
7676

7777
pos = -pos-1;
78-
if (it->subtree_alloc <= it->subtree_nr) {
79-
it->subtree_alloc = alloc_nr(it->subtree_alloc);
80-
it->down = xrealloc(it->down, it->subtree_alloc *
81-
sizeof(*it->down));
82-
}
78+
ALLOC_GROW(it->down, it->subtree_nr + 1, it->subtree_alloc);
8379
it->subtree_nr++;
8480

8581
down = xmalloc(sizeof(*down) + pathlen + 1);

0 commit comments

Comments
 (0)