perf tools: Introduce zalloc() for the common calloc(1, N) case

This way we type less characters and it looks more like the
kzalloc kernel counterpart.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1259071517-3242-3-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Arnaldo Carvalho de Melo
2009-11-24 12:05:16 -02:00
committed by Ingo Molnar
parent b32d133aec
commit 364794845c
10 changed files with 25 additions and 25 deletions

View File

@@ -94,15 +94,14 @@ static void kernel_maps__fixup_end(void)
static struct symbol *symbol__new(u64 start, u64 len, const char *name)
{
size_t namelen = strlen(name) + 1;
struct symbol *self = calloc(1, (symbol__priv_size +
sizeof(*self) + namelen));
if (!self)
struct symbol *self = zalloc(symbol__priv_size +
sizeof(*self) + namelen);
if (self == NULL)
return NULL;
if (symbol__priv_size) {
memset(self, 0, symbol__priv_size);
if (symbol__priv_size)
self = ((void *)self) + symbol__priv_size;
}
self->start = start;
self->end = len ? start + len - 1 : start;