summaryrefslogtreecommitdiff
path: root/cache-tree.c
diff options
context:
space:
mode:
authorDmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru>2014-03-04 02:31:51 +0400
committerJunio C Hamano <gitster@pobox.com>2014-03-03 14:45:35 -0800
commitbcc7a03285a2f0173a2d8afcc951c6dc0fc4eda8 (patch)
tree2fda7c73d11fc281f60133dd595c37a791fe749e /cache-tree.c
parent5cbbe13a9f16e7ddebd186dbf1dddb16185b968f (diff)
downloadgit-bcc7a03285a2f0173a2d8afcc951c6dc0fc4eda8.tar.gz
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>
Diffstat (limited to 'cache-tree.c')
-rw-r--r--cache-tree.c6
1 files changed, 1 insertions, 5 deletions
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);