mirror of
https://github.com/systemd/systemd.git
synced 2024-11-06 08:26:52 +03:00
bootchart: Convert malloc/memset to calloc
This commit is contained in:
parent
53f5329f7a
commit
a2e9b33808
@ -232,12 +232,11 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* start with empty ps LL */
|
/* start with empty ps LL */
|
||||||
ps_first = malloc(sizeof(struct ps_struct));
|
ps_first = calloc(1, sizeof(struct ps_struct));
|
||||||
if (!ps_first) {
|
if (!ps_first) {
|
||||||
perror("malloc(ps_struct)");
|
perror("calloc(ps_struct)");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
memset(ps_first, 0, sizeof(struct ps_struct));
|
|
||||||
|
|
||||||
/* handle TERM/INT nicely */
|
/* handle TERM/INT nicely */
|
||||||
memset(&sig, 0, sizeof(struct sigaction));
|
memset(&sig, 0, sizeof(struct sigaction));
|
||||||
|
@ -225,21 +225,19 @@ schedstat_next:
|
|||||||
char t[32];
|
char t[32];
|
||||||
struct ps_struct *parent;
|
struct ps_struct *parent;
|
||||||
|
|
||||||
ps->next_ps = malloc(sizeof(struct ps_struct));
|
ps->next_ps = calloc(1, sizeof(struct ps_struct));
|
||||||
if (!ps->next_ps) {
|
if (!ps->next_ps) {
|
||||||
perror("malloc(ps_struct)");
|
perror("calloc(ps_struct)");
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
memset(ps->next_ps, 0, sizeof(struct ps_struct));
|
|
||||||
ps = ps->next_ps;
|
ps = ps->next_ps;
|
||||||
ps->pid = pid;
|
ps->pid = pid;
|
||||||
|
|
||||||
ps->sample = malloc(sizeof(struct ps_sched_struct) * (len + 1));
|
ps->sample = calloc(len + 1, sizeof(struct ps_sched_struct));
|
||||||
if (!ps->sample) {
|
if (!ps->sample) {
|
||||||
perror("malloc(ps_struct)");
|
perror("calloc(ps_struct)");
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
memset(ps->sample, 0, sizeof(struct ps_sched_struct) * (len + 1));
|
|
||||||
|
|
||||||
pscount++;
|
pscount++;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user