diff options
author | Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru> | 2014-03-04 02:31:56 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-03-03 14:49:17 -0800 |
commit | 72004b4310ecc41c87b4bd6357642c6c5cfe9077 (patch) | |
tree | 2e376bacefaf9c393636c39695b4104699187e99 /replace_object.c | |
parent | 104fb26a1e4570d56c7c0a514397ed18e9610b3d (diff) | |
download | git-72004b4310ecc41c87b4bd6357642c6c5cfe9077.tar.gz |
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>
Diffstat (limited to 'replace_object.c')
-rw-r--r-- | replace_object.c | 8 |
1 files changed, 2 insertions, 6 deletions
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, |