aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/symbol.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-11-24 09:05:16 -0500
committerIngo Molnar <mingo@elte.hu>2009-11-24 10:37:02 -0500
commit364794845cbc49e638b83d7ef739524291e1e961 (patch)
treee720975b26d307d6566afb9305c9f6e44290a7da /tools/perf/util/symbol.c
parentb32d133aec5dc882cf783a293f393bfb3f4379e1 (diff)
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>
Diffstat (limited to 'tools/perf/util/symbol.c')
-rw-r--r--tools/perf/util/symbol.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index c4ca974b36e3..8db85b4f553f 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -94,15 +94,14 @@ static void kernel_maps__fixup_end(void)
94static struct symbol *symbol__new(u64 start, u64 len, const char *name) 94static struct symbol *symbol__new(u64 start, u64 len, const char *name)
95{ 95{
96 size_t namelen = strlen(name) + 1; 96 size_t namelen = strlen(name) + 1;
97 struct symbol *self = calloc(1, (symbol__priv_size + 97 struct symbol *self = zalloc(symbol__priv_size +
98 sizeof(*self) + namelen)); 98 sizeof(*self) + namelen);
99 if (!self) 99 if (self == NULL)
100 return NULL; 100 return NULL;
101 101
102 if (symbol__priv_size) { 102 if (symbol__priv_size)
103 memset(self, 0, symbol__priv_size);
104 self = ((void *)self) + symbol__priv_size; 103 self = ((void *)self) + symbol__priv_size;
105 } 104
106 self->start = start; 105 self->start = start;
107 self->end = len ? start + len - 1 : start; 106 self->end = len ? start + len - 1 : start;
108 107