Skip to content

Commit

Permalink
read-cache.c: use ALLOC_GROW() in add_index_entry()
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 66d9f38 commit 999f566
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions read-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -993,11 +993,7 @@ int add_index_entry(struct index_state *istate, struct cache_entry *ce, int opti
}

/* Make sure the array is big enough .. */
if (istate->cache_nr == istate->cache_alloc) {
istate->cache_alloc = alloc_nr(istate->cache_alloc);
istate->cache = xrealloc(istate->cache,
istate->cache_alloc * sizeof(*istate->cache));
}
ALLOC_GROW(istate->cache, istate->cache_nr + 1, istate->cache_alloc);

/* Add it in.. */
istate->cache_nr++;
Expand Down

0 comments on commit 999f566

Please sign in to comment.