From: Dmitry S. Dolzhenko Date: Mon, 3 Mar 2014 22:32:01 +0000 (+0400) Subject: read-cache.c: use ALLOC_GROW() in add_index_entry() X-Git-Tag: v2.0.0-rc0~97^2~1 X-Git-Url: http://git.bitbasher.net/?a=commitdiff_plain;h=999f566013cf4102c07b0cdbffba419eadc7b368;p=git.git read-cache.c: use ALLOC_GROW() in add_index_entry() Signed-off-by: Dmitry S. Dolzhenko Signed-off-by: Junio C Hamano --- diff --git a/read-cache.c b/read-cache.c index 33dd676ccb..40dbec92ac 100644 --- a/read-cache.c +++ b/read-cache.c @@ -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++;