From 51a60f5bfbaf1ee7c7a2d2b73eca4f042f7af8cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= 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 Signed-off-by: Junio C Hamano --- compat/mingw.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'compat') diff --git a/compat/mingw.c b/compat/mingw.c index e9892f8ee4..363a957a1d 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -1226,8 +1226,7 @@ static int WSAAPI getaddrinfo_stub(const char *node, const char *service, else ai->ai_canonname = NULL; - sin = xmalloc(ai->ai_addrlen); - memset(sin, 0, ai->ai_addrlen); + sin = xcalloc(1, ai->ai_addrlen); sin->sin_family = AF_INET; /* Note: getaddrinfo is supposed to allow service to be a string, * which should be looked up using getservbyname. This is -- cgit v1.2.3