From: Dmitry S. Dolzhenko Date: Mon, 3 Mar 2014 22:31:55 +0000 (+0400) Subject: patch-ids.c: use ALLOC_GROW() in add_commit() X-Git-Tag: v2.0.0-rc0~97^2~7 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/104fb26a1e4570d56c7c0a514397ed18e9610b3d?ds=sidebyside patch-ids.c: use ALLOC_GROW() in add_commit() Signed-off-by: Dmitry S. Dolzhenko Signed-off-by: Junio C Hamano --- diff --git a/patch-ids.c b/patch-ids.c index bc8a28fdd7..bf81b92361 100644 --- a/patch-ids.c +++ b/patch-ids.c @@ -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));