From 7525cd8c3522827be57915941ebbba859c45ce0b Mon Sep 17 00:00:00 2001 From: Seija Kijin Date: Wed, 18 Dec 2024 16:48:32 +0000 Subject: git: use calloc instead of malloc + memset where possible Avoid calling malloc + memset by calling calloc. Signed-off-by: Seija Kijin Signed-off-by: Junio C Hamano --- remote.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'remote.c') diff --git a/remote.c b/remote.c index 10104d11e3..462ff10527 100644 --- a/remote.c +++ b/remote.c @@ -2854,9 +2854,9 @@ void apply_push_cas(struct push_cas_option *cas, struct remote_state *remote_state_new(void) { - struct remote_state *r = xmalloc(sizeof(*r)); + struct remote_state *r; - memset(r, 0, sizeof(*r)); + CALLOC_ARRAY(r, 1); hashmap_init(&r->remotes_hash, remotes_hash_cmp, NULL, 0); hashmap_init(&r->branches_hash, branches_hash_cmp, NULL, 0); -- cgit v1.3