From: Dmitry S. Dolzhenko Date: Mon, 3 Mar 2014 22:31:56 +0000 (+0400) Subject: replace_object.c: use ALLOC_GROW() in register_replace_object() X-Git-Tag: v2.0.0-rc0~97^2~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=72004b4310ecc41c87b4bd6357642c6c5cfe9077;p=git replace_object.c: use ALLOC_GROW() in register_replace_object() Signed-off-by: Dmitry S. Dolzhenko Signed-off-by: Junio C Hamano --- diff --git a/replace_object.c b/replace_object.c index cdcaf8cbe2..843deef599 100644 --- a/replace_object.c +++ b/replace_object.c @@ -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,