git: use calloc instead of malloc + memset where possible

Avoid calling malloc + memset by calling calloc.

Signed-off-by: Seija Kijin <doremylover123@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Seija Kijin
2024-12-18 16:48:32 +00:00
committed by Junio C Hamano
parent d882f382b3
commit 7525cd8c35
2 changed files with 7 additions and 7 deletions

View File

@@ -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);