summaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorDmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru>2014-03-03 22:31:52 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-03-03 22:47:07 (GMT)
commitd6e82b575a7dc16be03f67fc3c4b648bc18df09f (patch)
treeb833c49bd026c24b3bce73fbd4acd58e441f1b8f /commit.c
parentbcc7a03285a2f0173a2d8afcc951c6dc0fc4eda8 (diff)
downloadgit-d6e82b575a7dc16be03f67fc3c4b648bc18df09f.zip
git-d6e82b575a7dc16be03f67fc3c4b648bc18df09f.tar.gz
git-d6e82b575a7dc16be03f67fc3c4b648bc18df09f.tar.bz2
commit.c: use ALLOC_GROW() in register_commit_graft()
Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/commit.c b/commit.c
index 6bf4fe0..e004314 100644
--- a/commit.c
+++ b/commit.c
@@ -147,12 +147,8 @@ int register_commit_graft(struct commit_graft *graft, int ignore_dups)
return 1;
}
pos = -pos - 1;
- if (commit_graft_alloc <= ++commit_graft_nr) {
- commit_graft_alloc = alloc_nr(commit_graft_alloc);
- commit_graft = xrealloc(commit_graft,
- sizeof(*commit_graft) *
- commit_graft_alloc);
- }
+ ALLOC_GROW(commit_graft, commit_graft_nr + 1, commit_graft_alloc);
+ commit_graft_nr++;
if (pos < commit_graft_nr)
memmove(commit_graft + pos + 1,
commit_graft + pos,