summaryrefslogtreecommitdiff
path: root/builtin/mktree.c
diff options
context:
space:
mode:
authorDmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru>2014-03-03 22:32:00 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-03-03 22:54:45 (GMT)
commit66d9f38bc72b4415046704697f3d3898afbce73a (patch)
tree2d029f421227cd9fb87013508d0c58ccb1f672c1 /builtin/mktree.c
parent3a7fa03db97eddec274af2ef22d96fc6f486f7c0 (diff)
downloadgit-66d9f38bc72b4415046704697f3d3898afbce73a.zip
git-66d9f38bc72b4415046704697f3d3898afbce73a.tar.gz
git-66d9f38bc72b4415046704697f3d3898afbce73a.tar.bz2
builtin/mktree.c: use ALLOC_GROW() in append_to_tree()
Helped-by: He Sun <sunheehnus@gmail.com> Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/mktree.c')
-rw-r--r--builtin/mktree.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/builtin/mktree.c b/builtin/mktree.c
index f92ba40..a964d6b 100644
--- a/builtin/mktree.c
+++ b/builtin/mktree.c
@@ -23,10 +23,7 @@ static void append_to_tree(unsigned mode, unsigned char *sha1, char *path)
if (strchr(path, '/'))
die("path %s contains slash", path);
- if (alloc <= used) {
- alloc = alloc_nr(used);
- entries = xrealloc(entries, sizeof(*entries) * alloc);
- }
+ ALLOC_GROW(entries, used + 1, alloc);
ent = entries[used++] = xmalloc(sizeof(**entries) + len + 1);
ent->mode = mode;
ent->len = len;