Use initalization instead of explicit zeroing in more places

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2013-04-10 18:59:42 -04:00
parent 0affed79d2
commit 1c6330456c
4 changed files with 20 additions and 36 deletions
+3 -3
View File
@@ -239,7 +239,9 @@ static int parse_args(int argc, char *argv[]) {
int main(int argc, char *argv[]) {
_cleanup_free_ char *build = NULL;
struct sigaction sig;
struct sigaction sig = {
.sa_handler = signal_handler,
};
struct ps_struct *ps;
char output_file[PATH_MAX];
char datestr[200];
@@ -279,8 +281,6 @@ int main(int argc, char *argv[]) {
}
/* handle TERM/INT nicely */
memset(&sig, 0, sizeof(struct sigaction));
sig.sa_handler = signal_handler;
sigaction(SIGHUP, &sig, NULL);
interval = (1.0 / arg_hz) * 1000000000.0;
+4 -6
View File
@@ -978,12 +978,11 @@ static void svg_ps_bars(void) {
static void svg_top_ten_cpu(void) {
struct ps_struct *top[10];
struct ps_struct emptyps;
struct ps_struct emptyps = {};
struct ps_struct *ps;
int n, m;
memset(&emptyps, 0, sizeof(struct ps_struct));
for (n=0; n < 10; n++)
for (n = 0; n < (int) ELEMENTSOF(top); n++)
top[n] = &emptyps;
/* walk all ps's and setup ptrs */
@@ -1011,12 +1010,11 @@ static void svg_top_ten_cpu(void) {
static void svg_top_ten_pss(void) {
struct ps_struct *top[10];
struct ps_struct emptyps;
struct ps_struct emptyps = {};
struct ps_struct *ps;
int n, m;
memset(&emptyps, 0, sizeof(struct ps_struct));
for (n=0; n < 10; n++)
for (n = 0; n < (int) ELEMENTSOF(top); n++)
top[n] = &emptyps;
/* walk all ps's and setup ptrs */