Use calloc() when requesting zero'ed memory allocation rather than rolling
our own.
This commit is contained in:
parent
8c626f6741
commit
2f487fe4e4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=175779
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user