Skip to content

Commit

Permalink
replace_object.c: use ALLOC_GROW() in register_replace_object()
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 104fb26 commit 72004b4
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions replace_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,8 @@ static int register_replace_object(struct replace_object *replace,
return 1;
}
pos = -pos - 1;
if (replace_object_alloc <= ++replace_object_nr) {
replace_object_alloc = alloc_nr(replace_object_alloc);
replace_object = xrealloc(replace_object,
sizeof(*replace_object) *
replace_object_alloc);
}
ALLOC_GROW(replace_object, replace_object_nr + 1, replace_object_alloc);
replace_object_nr++;
if (pos < replace_object_nr)
memmove(replace_object + pos + 1,
replace_object + pos,
Expand Down

0 comments on commit 72004b4

Please sign in to comment.