Skip to content

Commit 9af49f8

Browse files
Dmitry S. Dolzhenkogitster
authored andcommitted
dir.c: use ALLOC_GROW() in create_simplify()
Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 6647cc2 commit 9af49f8

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

dir.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,10 +1329,7 @@ static struct path_simplify *create_simplify(const char **pathspec)
13291329

13301330
for (nr = 0 ; ; nr++) {
13311331
const char *match;
1332-
if (nr >= alloc) {
1333-
alloc = alloc_nr(alloc);
1334-
simplify = xrealloc(simplify, alloc * sizeof(*simplify));
1335-
}
1332+
ALLOC_GROW(simplify, nr + 1, alloc);
13361333
match = *pathspec++;
13371334
if (!match)
13381335
break;

0 commit comments

Comments
 (0)