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

@ -225,7 +225,7 @@ static void calibrate_sleep_measurement_overhead(void)
static struct sched_atom *
get_new_event(struct task_desc *task, u64 timestamp)
{
struct sched_atom *event = calloc(1, sizeof(*event));
struct sched_atom *event = zalloc(sizeof(*event));
unsigned long idx = task->nr_events;
size_t size;
@ -293,7 +293,7 @@ add_sched_event_wakeup(struct task_desc *task, u64 timestamp,
return;
}
wakee_event->wait_sem = calloc(1, sizeof(*wakee_event->wait_sem));
wakee_event->wait_sem = zalloc(sizeof(*wakee_event->wait_sem));
sem_init(wakee_event->wait_sem, 0, 0);
wakee_event->specific_wait = 1;
event->wait_sem = wakee_event->wait_sem;
@ -323,7 +323,7 @@ static struct task_desc *register_pid(unsigned long pid, const char *comm)
if (task)
return task;
task = calloc(1, sizeof(*task));
task = zalloc(sizeof(*task));
task->pid = pid;
task->nr = nr_tasks;
strcpy(task->comm, comm);
@ -962,9 +962,7 @@ __thread_latency_insert(struct rb_root *root, struct work_atoms *data,
static void thread_atoms_insert(struct thread *thread)
{
struct work_atoms *atoms;
atoms = calloc(sizeof(*atoms), 1);
struct work_atoms *atoms = zalloc(sizeof(*atoms));
if (!atoms)
die("No memory");
@ -996,9 +994,7 @@ add_sched_out_event(struct work_atoms *atoms,
char run_state,
u64 timestamp)
{
struct work_atom *atom;
atom = calloc(sizeof(*atom), 1);
struct work_atom *atom = zalloc(sizeof(*atom));
if (!atom)
die("Non memory");