1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-18 03:06:17 +02:00

patch-ids.c: use ALLOC_GROW() in add_commit()

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:55 +04:00 committed by Junio C Hamano
parent 337ce247e3
commit 104fb26a1e

View File

@ -83,10 +83,7 @@ static struct patch_id *add_commit(struct commit *commit,
ent = &bucket->bucket[bucket->nr++];
hashcpy(ent->patch_id, sha1);
if (ids->alloc <= ids->nr) {
ids->alloc = alloc_nr(ids->nr);
ids->table = xrealloc(ids->table, sizeof(ent) * ids->alloc);
}
ALLOC_GROW(ids->table, ids->nr + 1, ids->alloc);
if (pos < ids->nr)
memmove(ids->table + pos + 1, ids->table + pos,
sizeof(ent) * (ids->nr - pos));