Subject: [PATCH v3 10/11] dir.c: use ALLOC_GROW() in create_simplify()

From: "Dmitry S. Dolzhenko" <[email-masked]>
Date: Mon, 03 Mar 2014 11:25:31 +0400

Signed-off-by: Dmitry S. Dolzhenko <[email-masked]>
---
 dir.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/dir.c b/dir.c
index 98bb50f..4ae38e4 100644
--- a/dir.c
+++ b/dir.c
@@ -1341,10 +1341,7 @@ static struct path_simplify *create_simplify(const char **pathspec)
 
 	for (nr = 0 ; ; nr++) {
 		const char *match;
-		if (nr >= alloc) {
-			alloc = alloc_nr(alloc);
-			simplify = xrealloc(simplify, alloc * sizeof(*simplify));
-		}
+		ALLOC_GROW(simplify, nr + 1, alloc);
 		match = *pathspec++;
 		if (!match)
 			break;
-- 
1.8.5.3