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>
This commit is contained in:
Dmitry S. Dolzhenko 2014-03-04 02:31:59 +04:00 committed by Junio C Hamano
parent 9af49f822b
commit 3a7fa03db9

7
attr.c
View File

@ -338,12 +338,7 @@ static void handle_attr_line(struct attr_stack *res,
a = parse_attr_line(line, src, lineno, macro_ok);
if (!a)
return;
if (res->alloc <= res->num_matches) {
res->alloc = alloc_nr(res->num_matches);
res->attrs = xrealloc(res->attrs,
sizeof(struct match_attr *) *
res->alloc);
}
ALLOC_GROW(res->attrs, res->num_matches + 1, res->alloc);
res->attrs[res->num_matches++] = a;
}