Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 999f566

Browse files
Dmitry S. Dolzhenkogitster
authored andcommitted
read-cache.c: use ALLOC_GROW() in add_index_entry()
Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 66d9f38 commit 999f566

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

read-cache.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -993,11 +993,7 @@ int add_index_entry(struct index_state *istate, struct cache_entry *ce, int opti
993993
}
994994

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

1002998
/* Add it in.. */
1003999
istate->cache_nr++;

0 commit comments

Comments
 (0)