Skip to content

Commit d6e82b5

Browse files
Dmitry S. Dolzhenkogitster
authored andcommitted
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>
1 parent bcc7a03 commit d6e82b5

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

commit.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,8 @@ int register_commit_graft(struct commit_graft *graft, int ignore_dups)
147147
return 1;
148148
}
149149
pos = -pos - 1;
150-
if (commit_graft_alloc <= ++commit_graft_nr) {
151-
commit_graft_alloc = alloc_nr(commit_graft_alloc);
152-
commit_graft = xrealloc(commit_graft,
153-
sizeof(*commit_graft) *
154-
commit_graft_alloc);
155-
}
150+
ALLOC_GROW(commit_graft, commit_graft_nr + 1, commit_graft_alloc);
151+
commit_graft_nr++;
156152
if (pos < commit_graft_nr)
157153
memmove(commit_graft + pos + 1,
158154
commit_graft + pos,

0 commit comments

Comments
 (0)