From 6aa3c8ee5aea727cdf83273a6aff72c0f4e0d4a0 Mon Sep 17 00:00:00 2001 From: delphij Date: Tue, 29 Jan 2008 00:06:44 +0000 Subject: Use calloc() when requesting zero'ed memory allocation rather than rolling our own. --- usr.bin/top/machine.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'usr.bin/top') diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c index 5e7579b..f042079 100644 --- a/usr.bin/top/machine.c +++ b/usr.bin/top/machine.c @@ -335,14 +335,10 @@ machine_init(struct statics *statics, char do_unames) Header_lines += ncpus - 1; /* 7 */ } size = sizeof(long) * ncpus * CPUSTATES; - pcpu_cp_time = malloc(size); - pcpu_cp_old = malloc(size); - pcpu_cp_diff = malloc(size); - pcpu_cpu_states = malloc(size); - bzero(pcpu_cp_time, size); - bzero(pcpu_cp_old, size); - bzero(pcpu_cp_diff, size); - bzero(pcpu_cpu_states, size); + pcpu_cp_time = calloc(1, size); + pcpu_cp_old = calloc(1, size); + pcpu_cp_diff = calloc(1, size); + pcpu_cpu_states = calloc(1, size); statics->ncpus = ncpus; } else { statics->ncpus = 1; -- cgit v1.1