Commit 3a7fa03d authored by Dmitry S. Dolzhenko's avatar Dmitry S. Dolzhenko Committed by Junio C Hamano

attr.c: use ALLOC_GROW() in handle_attr_line()

Signed-off-by: default avatarDmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru>
Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
parent 9af49f82
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment