Skip to content

Commit

Permalink
patch-ids.c: use ALLOC_GROW() in add_commit()
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Dmitry S. Dolzhenko authored and Junio C Hamano committed Mar 3, 2014
1 parent 337ce24 commit 104fb26
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions patch-ids.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 104fb26

Please sign in to comment.