From ca56dadb4b65ccaeab809d80db80a312dc00941a Mon Sep 17 00:00:00 2001 From: René Scharfe 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 --- resolve-undo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'resolve-undo.c') diff --git a/resolve-undo.c b/resolve-undo.c index 236320f179..bbd2e57fe4 100644 --- a/resolve-undo.c +++ b/resolve-undo.c @@ -15,7 +15,7 @@ void record_resolve_undo(struct index_state *istate, struct cache_entry *ce) return; if (!istate->resolve_undo) { - resolve_undo = xcalloc(1, sizeof(*resolve_undo)); + CALLOC_ARRAY(resolve_undo, 1); resolve_undo->strdup_strings = 1; istate->resolve_undo = resolve_undo; } @@ -57,7 +57,7 @@ struct string_list *resolve_undo_read(const char *data, unsigned long size) int i; const unsigned rawsz = the_hash_algo->rawsz; - resolve_undo = xcalloc(1, sizeof(*resolve_undo)); + CALLOC_ARRAY(resolve_undo, 1); resolve_undo->strdup_strings = 1; while (size) { -- cgit 1.2.3-korg