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

Revision v4 of 3 in this series.

Revisions (3)
  1. v2 [diff vs current]
  2. v3 [diff vs current]
  3. v4 current

[PATCH v4 10/14] dir.c: use ALLOC_GROW() in create_simplify()

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>
---
 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.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