Thread (15 messages) flat view 15 messages, 1 author, 2016-06-15
DORMANTno replies

[PATCH v4 13/14] read-cache.c: use ALLOC_GROW() in add_index_entry()

From: Dmitry S. Dolzhenko <hidden>
Date: 2016-06-15 23:00:10
Subsystem: the rest · Maintainer: Linus Torvalds

Signed-off-by: Dmitry S. Dolzhenko <redacted>
---
 read-cache.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/read-cache.c b/read-cache.c
index fb440b4..cbdf954 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -990,11 +990,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++;
-- 
1.8.3.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help