mirror of
https://github.com/git/git
synced 2024-08-25 02:35:46 +00:00
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>
This commit is contained in:
parent
bcc7a03285
commit
d6e82b575a
8
commit.c
8
commit.c
|
@ -147,12 +147,8 @@ int register_commit_graft(struct commit_graft *graft, int ignore_dups)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
pos = -pos - 1;
|
pos = -pos - 1;
|
||||||
if (commit_graft_alloc <= ++commit_graft_nr) {
|
ALLOC_GROW(commit_graft, commit_graft_nr + 1, commit_graft_alloc);
|
||||||
commit_graft_alloc = alloc_nr(commit_graft_alloc);
|
commit_graft_nr++;
|
||||||
commit_graft = xrealloc(commit_graft,
|
|
||||||
sizeof(*commit_graft) *
|
|
||||||
commit_graft_alloc);
|
|
||||||
}
|
|
||||||
if (pos < commit_graft_nr)
|
if (pos < commit_graft_nr)
|
||||||
memmove(commit_graft + pos + 1,
|
memmove(commit_graft + pos + 1,
|
||||||
commit_graft + pos,
|
commit_graft + pos,
|
||||||
|
|
Loading…
Reference in a new issue