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>
Dmitry S. Dolzhenko committed
Mar 4, 2014 at 02:31 UTC
104fb26a1e4570d56c7c0a514397ed18e9610b3d
1 file changed
+1
-4
patch-ids.c
+1
-4
@@ -83,10 +83,7 @@ static struct patch_id *add_commit(struct commit *commit,
83
ent = &bucket->bucket[bucket->nr++];
84
hashcpy(ent->patch_id, sha1);
85
86
- if (ids->alloc <= ids->nr) {
87
- ids->alloc = alloc_nr(ids->nr);
88
- ids->table = xrealloc(ids->table, sizeof(ent) * ids->alloc);
89
- }
86
+ ALLOC_GROW(ids->table, ids->nr + 1, ids->alloc);
87
if (pos < ids->nr)
88
memmove(ids->table + pos + 1, ids->table + pos,
89
sizeof(ent) * (ids->nr - pos));