diff options
author | delphij <delphij@FreeBSD.org> | 2009-02-21 03:43:20 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2009-02-21 03:43:20 +0000 |
commit | c36f13a9588beb76234db3bb71c93381e34f8efd (patch) | |
tree | 023474e22f993d4127b5c9942ae1aa800ca6c08e /usr.bin/vmstat | |
parent | a9845d8d05b87fe7067cadf2fcb2579d8b65e660 (diff) | |
download | FreeBSD-src-c36f13a9588beb76234db3bb71c93381e34f8efd.zip FreeBSD-src-c36f13a9588beb76234db3bb71c93381e34f8efd.tar.gz |
Utilize calloc() instead of bzero'ing manually.
Diffstat (limited to 'usr.bin/vmstat')
-rw-r--r-- | usr.bin/vmstat/vmstat.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c index a05dfd4..aa1d13b 100644 --- a/usr.bin/vmstat/vmstat.c +++ b/usr.bin/vmstat/vmstat.c @@ -346,10 +346,8 @@ getdrivedata(char **argv) if ((num_devices = devstat_getnumdevs(NULL)) < 0) errx(1, "%s", devstat_errbuf); - cur.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo)); - last.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo)); - bzero(cur.dinfo, sizeof(struct devinfo)); - bzero(last.dinfo, sizeof(struct devinfo)); + cur.dinfo = (struct devinfo *)calloc(1, sizeof(struct devinfo)); + last.dinfo = (struct devinfo *)calloc(1, sizeof(struct devinfo)); if (devstat_getdevs(NULL, &cur) == -1) errx(1, "%s", devstat_errbuf); @@ -616,10 +614,8 @@ dovmstat(unsigned int interval, int reps) if (Pflag) { ncpus = getcpuinfo(&cpumask, &maxid); size_cp_times = sizeof(long) * (maxid + 1) * CPUSTATES; - cur_cp_times = malloc(size_cp_times); - last_cp_times = malloc(size_cp_times); - bzero(cur_cp_times, size_cp_times); - bzero(last_cp_times, size_cp_times); + cur_cp_times = calloc(1, size_cp_times); + last_cp_times = calloc(1, size_cp_times); } for (hdrcnt = 1;;) { if (!--hdrcnt) |