From 51a60f5bfbaf1ee7c7a2d2b73eca4f042f7af8cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= <l.s.r@web.de>
Date: Sat, 19 Jul 2014 15:56:26 +0200
Subject: use xcalloc() to allocate zero-initialized memory

Use xcalloc() instead of xmalloc() followed by memset() to allocate
and zero out memory because it's shorter and avoids duplicating the
function parameters.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 builtin/index-pack.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

(limited to 'builtin/index-pack.c')

diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 8b3bd29db..9ca020392 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -362,8 +362,7 @@ static void set_thread_data(struct thread_local *data)
 
 static struct base_data *alloc_base_data(void)
 {
-	struct base_data *base = xmalloc(sizeof(struct base_data));
-	memset(base, 0, sizeof(*base));
+	struct base_data *base = xcalloc(1, sizeof(struct base_data));
 	base->ref_last = -1;
 	base->ofs_last = -1;
 	return base;
-- 
cgit v1.2.1