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

Commit 3a7fa03

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

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

attr.c

+1-6
Original file line numberDiff line numberDiff line change
@@ -338,12 +338,7 @@ static void handle_attr_line(struct attr_stack *res,
338338
a = parse_attr_line(line, src, lineno, macro_ok);
339339
if (!a)
340340
return;
341-
if (res->alloc <= res->num_matches) {
342-
res->alloc = alloc_nr(res->num_matches);
343-
res->attrs = xrealloc(res->attrs,
344-
sizeof(struct match_attr *) *
345-
res->alloc);
346-
}
341+
ALLOC_GROW(res->attrs, res->num_matches + 1, res->alloc);
347342
res->attrs[res->num_matches++] = a;
348343
}
349344

0 commit comments

Comments
 (0)