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>
Dmitry S. Dolzhenko committed
Mar 4, 2014 at 02:31 UTC
bcc7a03285a2f0173a2d8afcc951c6dc0fc4eda8
1 file changed
+1
-5
cache-tree.c
+1
-5
@@ -75,11 +75,7 @@ static struct cache_tree_sub *find_subtree(struct cache_tree *it,
75
return NULL;
76
77
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);
79
it->subtree_nr++;
80
81
down = xmalloc(sizeof(*down) + pathlen + 1);