Skip to content

Commit

Permalink
commit.c: use ALLOC_GROW() in register_commit_graft()
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Dmitry S. Dolzhenko authored and Junio C Hamano committed Mar 3, 2014
1 parent bcc7a03 commit d6e82b5
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d6e82b5

Please sign in to comment.