OSDN Git Service
(root)
/
git-core
/
git.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3a7fa03
)
builtin/mktree.c: use ALLOC_GROW() in append_to_tree()
author
Dmitry S. Dolzhenko
<dmitrys.dolzhenko@yandex.ru>
Mon, 3 Mar 2014 22:32:00 +0000
(
02:32
+0400)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 3 Mar 2014 22:54:45 +0000
(14:54 -0800)
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>
builtin/mktree.c
patch
|
blob
|
history
diff --git
a/builtin/mktree.c
b/builtin/mktree.c
index
f92ba40
..
a964d6b
100644
(file)
--- 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;