{"thread":{"id":"60657","subject":"[PATCH] fast-import: use mem_pool_calloc()","startedAt":"2023-12-26T08:17:47Z","lastAt":"2023-12-26T19:23:03Z","messageCount":2,"participants":["René Scharfe","Elijah Newren"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"486024","messageId":"50c1f410-ca37-4c1c-a28b-3e9fad49f2b4@web.de","threadId":"60657","inReplyTo":null,"subject":"[PATCH] fast-import: use mem_pool_calloc()","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2023-12-26T08:17:45Z","receivedAt":"2023-12-26T08:17:47Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Use mem_pool_calloc() to get a zeroed buffer instead of zeroing it\nourselves.  This makes the code clearer and less repetitive.\n\nSigned-off-by: René Scharfe <l.s.r@web.de>\n---\n builtin/fast-import.c | 3 +--\n 1 file changed, 1 insertion(+), 2 deletions(-)\n\ndiff --git a/builtin/fast-import.c b/builtin/fast-import.c\nindex 444f41cf8c..92eda20683 100644\n--- a/builtin/fast-import.c\n+++ b/builtin/fast-import.c\n@@ -2809,8 +2809,7 @@ static void parse_new_tag(const char *arg)\n \tenum object_type type;\n \tconst char *v;\n\n-\tt = mem_pool_alloc(&fi_mem_pool, sizeof(struct tag));\n-\tmemset(t, 0, sizeof(struct tag));\n+\tt = mem_pool_calloc(&fi_mem_pool, 1, sizeof(struct tag));\n \tt->name = mem_pool_strdup(&fi_mem_pool, arg);\n \tif (last_tag)\n \t\tlast_tag->next_tag = t;\n--\n2.43.0\n"},{"id":"486035","messageId":"CABPp-BFcUdheVde6-uFjtwC4ZAmVxJe6SOMTOwRRWDBqOT=DvA@mail.gmail.com","threadId":"60657","inReplyTo":"50c1f410-ca37-4c1c-a28b-3e9fad49f2b4@web.de","subject":"Re: [PATCH] fast-import: use mem_pool_calloc()","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-12-26T19:22:51Z","receivedAt":"2023-12-26T19:23:03Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Tue, Dec 26, 2023 at 12:18 AM René Scharfe <l.s.r@web.de> wrote:\n>\n> Use mem_pool_calloc() to get a zeroed buffer instead of zeroing it\n> ourselves.  This makes the code clearer and less repetitive.\n>\n> Signed-off-by: René Scharfe <l.s.r@web.de>\n> ---\n>  builtin/fast-import.c | 3 +--\n>  1 file changed, 1 insertion(+), 2 deletions(-)\n>\n> diff --git a/builtin/fast-import.c b/builtin/fast-import.c\n> index 444f41cf8c..92eda20683 100644\n> --- a/builtin/fast-import.c\n> +++ b/builtin/fast-import.c\n> @@ -2809,8 +2809,7 @@ static void parse_new_tag(const char *arg)\n>         enum object_type type;\n>         const char *v;\n>\n> -       t = mem_pool_alloc(&fi_mem_pool, sizeof(struct tag));\n> -       memset(t, 0, sizeof(struct tag));\n> +       t = mem_pool_calloc(&fi_mem_pool, 1, sizeof(struct tag));\n>         t->name = mem_pool_strdup(&fi_mem_pool, arg);\n>         if (last_tag)\n>                 last_tag->next_tag = t;\n> --\n> 2.43.0\n\nMakes sense; looks good to me.\n"}]}