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:
parent
104fb26a1e
commit
72004b4310
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user