From ca56dadb4b65ccaeab809d80db80a312dc00941a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Sat, 13 Mar 2021 17:17:22 +0100 Subject: use CALLOC_ARRAY MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add and apply a semantic patch for converting code that open-codes CALLOC_ARRAY to use it instead. It shortens the code and infers the element size automatically. Signed-off-by: René Scharfe Signed-off-by: Junio C Hamano --- send-pack.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'send-pack.c') diff --git a/send-pack.c b/send-pack.c index 9045f8a082..5f215b13c7 100644 --- a/send-pack.c +++ b/send-pack.c @@ -188,13 +188,13 @@ static int receive_status(struct packet_reader *reader, struct ref *refs) } if (new_report) { if (!hint->report) { - hint->report = xcalloc(1, sizeof(struct ref_push_report)); + CALLOC_ARRAY(hint->report, 1); report = hint->report; } else { report = hint->report; while (report->next) report = report->next; - report->next = xcalloc(1, sizeof(struct ref_push_report)); + CALLOC_ARRAY(report->next, 1); report = report->next; } new_report = 0; -- cgit v1.2.3