mirror of
https://github.com/git/git.git
synced 2026-01-10 01:56:42 +00:00
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>
This commit is contained in:
committed by
Junio C Hamano
parent
f1121499e6
commit
ca56dadb4b
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user