summaryrefslogtreecommitdiff
path: root/attr.c
diff options
context:
space:
mode:
authorDmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru>2014-03-03 22:31:59 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-03-03 22:54:37 (GMT)
commit3a7fa03db97eddec274af2ef22d96fc6f486f7c0 (patch)
tree38692183c19b7d2a18d06d01609a3a20b24d4b50 /attr.c
parent9af49f822bc1e4f00b356e052f666ae7714a0399 (diff)
downloadgit-3a7fa03db97eddec274af2ef22d96fc6f486f7c0.zip
git-3a7fa03db97eddec274af2ef22d96fc6f486f7c0.tar.gz
git-3a7fa03db97eddec274af2ef22d96fc6f486f7c0.tar.bz2
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 8d13d70..734222d 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;
}