replace_object.c: use ALLOC_GROW() in register_replace_object()

Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Dmitry S. Dolzhenko 2014-03-04 02:31:56 +04:00 committed by Junio C Hamano
parent 104fb26a1e
commit 72004b4310

View File

@ -36,12 +36,8 @@ static int register_replace_object(struct replace_object *replace,
return 1; return 1;
} }
pos = -pos - 1; pos = -pos - 1;
if (replace_object_alloc <= ++replace_object_nr) { ALLOC_GROW(replace_object, replace_object_nr + 1, replace_object_alloc);
replace_object_alloc = alloc_nr(replace_object_alloc); replace_object_nr++;
replace_object = xrealloc(replace_object,
sizeof(*replace_object) *
replace_object_alloc);
}
if (pos < replace_object_nr) if (pos < replace_object_nr)
memmove(replace_object + pos + 1, memmove(replace_object + pos + 1,
replace_object + pos, replace_object + pos,