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 --- commit-graph.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'commit-graph.c') diff --git a/commit-graph.c b/commit-graph.c index ca025ce8eb..e21eeea42b 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -516,7 +516,7 @@ static struct commit_graph *load_commit_graph_chain(struct repository *r, return NULL; count = st.st_size / (the_hash_algo->hexsz + 1); - oids = xcalloc(count, sizeof(struct object_id)); + CALLOC_ARRAY(oids, count); prepare_alt_odb(r); @@ -2238,7 +2238,7 @@ int write_commit_graph(struct object_directory *odb, if (!commit_graph_compatible(the_repository)) return 0; - ctx = xcalloc(1, sizeof(struct write_commit_graph_context)); + CALLOC_ARRAY(ctx, 1); ctx->r = the_repository; ctx->odb = odb; ctx->append = flags & COMMIT_GRAPH_WRITE_APPEND ? 1 : 0; -- cgit v1.2.3