summaryrefslogtreecommitdiff
path: root/transport-helper.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2021-03-13 16:17:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-03-14 00:00:09 (GMT)
commitca56dadb4b65ccaeab809d80db80a312dc00941a (patch)
treefa027eb80d076ebf7be7c3ea69a92cf47e594a1c /transport-helper.c
parentf1121499e6460e814ec3cffa0b18942ac529f768 (diff)
downloadgit-ca56dadb4b65ccaeab809d80db80a312dc00941a.zip
git-ca56dadb4b65ccaeab809d80db80a312dc00941a.tar.gz
git-ca56dadb4b65ccaeab809d80db80a312dc00941a.tar.bz2
use CALLOC_ARRAY
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 <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport-helper.c')
-rw-r--r--transport-helper.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/transport-helper.c b/transport-helper.c
index 49b7fb4..4cd7636 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -745,13 +745,13 @@ static int push_update_ref_status(struct strbuf *buf,
die(_("'option' without a matching 'ok/error' directive"));
if (state->new_report) {
if (!state->hint->report) {
- state->hint->report = xcalloc(1, sizeof(struct ref_push_report));
+ CALLOC_ARRAY(state->hint->report, 1);
state->report = state->hint->report;
} else {
state->report = state->hint->report;
while (state->report->next)
state->report = state->report->next;
- state->report->next = xcalloc(1, sizeof(struct ref_push_report));
+ CALLOC_ARRAY(state->report->next, 1);
state->report = state->report->next;
}
state->new_report = 0;