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 --- pathspec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'pathspec.c') diff --git a/pathspec.c b/pathspec.c index 804309995..0be5edbd1 100644 --- a/pathspec.c +++ b/pathspec.c @@ -389,8 +389,7 @@ void parse_pathspec(struct pathspec *pathspec, if (!(flags & PATHSPEC_PREFER_CWD)) die("BUG: PATHSPEC_PREFER_CWD requires arguments"); - pathspec->items = item = xmalloc(sizeof(*item)); - memset(item, 0, sizeof(*item)); + pathspec->items = item = xcalloc(1, sizeof(*item)); item->match = prefix; item->original = prefix; item->nowildcard_len = item->len = strlen(prefix); -- cgit v1.2.1