Commit 66d9f38b authored by Dmitry S. Dolzhenko's avatar Dmitry S. Dolzhenko Committed by Junio C Hamano

builtin/mktree.c: use ALLOC_GROW() in append_to_tree()

Helped-by: default avatarHe Sun <[email protected]>
Signed-off-by: default avatarDmitry S. Dolzhenko <[email protected]>
Signed-off-by: default avatarJunio C Hamano <[email protected]>
parent 3a7fa03d
......@@ -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;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment