summaryrefslogtreecommitdiffstats
path: root/usr.bin/top
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2008-01-29 00:06:44 +0000
committerdelphij <delphij@FreeBSD.org>2008-01-29 00:06:44 +0000
commit6aa3c8ee5aea727cdf83273a6aff72c0f4e0d4a0 (patch)
tree1e30c38fd0987c9b916b216c7cc9aee54a746ba4 /usr.bin/top
parent47c6625b332b084e29d30547f10f701723815759 (diff)
downloadFreeBSD-src-6aa3c8ee5aea727cdf83273a6aff72c0f4e0d4a0.zip
FreeBSD-src-6aa3c8ee5aea727cdf83273a6aff72c0f4e0d4a0.tar.gz
Use calloc() when requesting zero'ed memory allocation rather than rolling
our own.
Diffstat (limited to 'usr.bin/top')
-rw-r--r--usr.bin/top/machine.c12
1 files changed, 4 insertions, 8 deletions
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;
OpenPOWER on IntegriCloud