summaryrefslogtreecommitdiff
path: root/attr.c
diff options
context:
space:
mode:
authorLibravatar Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru>2014-03-04 02:31:59 +0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2014-03-03 14:54:37 -0800
commit3a7fa03db97eddec274af2ef22d96fc6f486f7c0 (patch)
tree38692183c19b7d2a18d06d01609a3a20b24d4b50 /attr.c
parentdir.c: use ALLOC_GROW() in create_simplify() (diff)
downloadtgif-3a7fa03db97eddec274af2ef22d96fc6f486f7c0.tar.xz
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>
Diffstat (limited to 'attr.c')
-rw-r--r--attr.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/attr.c b/attr.c
index 8d13d70e80..734222dc45 100644
--- a/attr.c
+++ b/attr.c
@@ -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;
}