{"thread":{"id":"26118","subject":"[PATCH] attr.c: Use ALLOC_GROW instead of alloc_nr and xrealloc.","startedAt":"2010-12-22T00:35:50Z","lastAt":"2010-12-22T01:04:35Z","messageCount":3,"participants":["Thiago Farina","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"158465","messageId":"3c6870c390110bd1bf5c5f59a99928afc86cf188.1292978127.git.tfransosi@gmail.com","threadId":"26118","inReplyTo":null,"subject":"[PATCH] attr.c: Use ALLOC_GROW instead of alloc_nr and xrealloc.","fromName":"Thiago Farina","fromEmail":"tfransosi@gmail.com","sentAt":"2010-12-22T00:35:50Z","receivedAt":"2010-12-22T00:35:50Z","isPatch":true,"sender":{"key":"tfransosi@gmail.com","avatar":"https://avatars.githubusercontent.com/u/970071?v=4"},"body":"Signed-off-by: Thiago Farina <tfransosi@gmail.com>\n---\n attr.c |    8 ++------\n 1 files changed, 2 insertions(+), 6 deletions(-)\n\ndiff --git a/attr.c b/attr.c\nindex 6aff695..fdc0515 100644\n--- a/attr.c\n+++ b/attr.c\n@@ -305,12 +305,8 @@ static void handle_attr_line(struct attr_stack *res,\n \ta = parse_attr_line(line, src, lineno, macro_ok);\n \tif (!a)\n \t\treturn;\n-\tif (res->alloc <= res->num_matches) {\n-\t\tres->alloc = alloc_nr(res->num_matches);\n-\t\tres->attrs = xrealloc(res->attrs,\n-\t\t\t\t      sizeof(struct match_attr *) *\n-\t\t\t\t      res->alloc);\n-\t}\n+\n+\tALLOC_GROW(res->attrs, res->num_matches + 1, res->alloc);\n \tres->attrs[res->num_matches++] = a;\n }\n \n-- \n1.7.3.2.343.g7d43d\n"},{"id":"158466","messageId":"7v1v5a7hc4.fsf@alter.siamese.dyndns.org","threadId":"26118","inReplyTo":"3c6870c390110bd1bf5c5f59a99928afc86cf188.1292978127.git.tfransosi@gmail.com","subject":"Re: [PATCH] attr.c: Use ALLOC_GROW instead of alloc_nr and xrealloc.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-12-22T00:59:39Z","receivedAt":"2010-12-22T00:59:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Instead of trickling these down, can you give a single patch to convert\nthe remaining ones you have been finding with \"git grep -e alloc_nr\"?\n"},{"id":"158467","messageId":"AANLkTinw-GeFp5BnBUK02_YU8=XoUw1uHprSg1Hja0sh@mail.gmail.com","threadId":"26118","inReplyTo":"7v1v5a7hc4.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] attr.c: Use ALLOC_GROW instead of alloc_nr and xrealloc.","fromName":"Thiago Farina","fromEmail":"tfransosi@gmail.com","sentAt":"2010-12-22T01:04:35Z","receivedAt":"2010-12-22T01:04:35Z","isPatch":true,"sender":{"key":"tfransosi@gmail.com","avatar":"https://avatars.githubusercontent.com/u/970071?v=4"},"body":"On Tue, Dec 21, 2010 at 10:59 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Instead of trickling these down, can you give a single patch to convert\n> the remaining ones you have been finding with \"git grep -e alloc_nr\"?\n>\n\n$ git grep -w alloc_nr | grep -v cache.h | wc -l\n\nSorry, but I wouldn't feel comfortable fixing 19 files now. At least\nnot exactly now. Perhaps on the weekend.\n"}]}