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>
Dmitry S. Dolzhenko committed
Mar 4, 2014 at 02:31 UTC
3a7fa03db97eddec274af2ef22d96fc6f486f7c0
1 file changed
+1
-6
attr.c
+1
-6
@@ -338,12 +338,7 @@ static void handle_attr_line(struct attr_stack *res,
338
a = parse_attr_line(line, src, lineno, macro_ok);
339
if (!a)
340
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);
342
res->attrs[res->num_matches++] = a;
343
}
344