* [PATCH] attr.c: Use ALLOC_GROW instead of alloc_nr and xrealloc.
@ 2010-12-22 0:35 Thiago Farina
2010-12-22 0:59 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Thiago Farina @ 2010-12-22 0:35 UTC (permalink / raw)
To: git
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
---
attr.c | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/attr.c b/attr.c
index 6aff695..fdc0515 100644
--- a/attr.c
+++ b/attr.c
@@ -305,12 +305,8 @@ 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;
}
--
1.7.3.2.343.g7d43d
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] attr.c: Use ALLOC_GROW instead of alloc_nr and xrealloc.
2010-12-22 0:35 [PATCH] attr.c: Use ALLOC_GROW instead of alloc_nr and xrealloc Thiago Farina
@ 2010-12-22 0:59 ` Junio C Hamano
2010-12-22 1:04 ` Thiago Farina
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2010-12-22 0:59 UTC (permalink / raw)
To: Thiago Farina; +Cc: git
Instead of trickling these down, can you give a single patch to convert
the remaining ones you have been finding with "git grep -e alloc_nr"?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] attr.c: Use ALLOC_GROW instead of alloc_nr and xrealloc.
2010-12-22 0:59 ` Junio C Hamano
@ 2010-12-22 1:04 ` Thiago Farina
0 siblings, 0 replies; 3+ messages in thread
From: Thiago Farina @ 2010-12-22 1:04 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Tue, Dec 21, 2010 at 10:59 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Instead of trickling these down, can you give a single patch to convert
> the remaining ones you have been finding with "git grep -e alloc_nr"?
>
$ git grep -w alloc_nr | grep -v cache.h | wc -l
Sorry, but I wouldn't feel comfortable fixing 19 files now. At least
not exactly now. Perhaps on the weekend.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-12-22 1:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-22 0:35 [PATCH] attr.c: Use ALLOC_GROW instead of alloc_nr and xrealloc Thiago Farina
2010-12-22 0:59 ` Junio C Hamano
2010-12-22 1:04 ` Thiago Farina
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox