From fde6dc210fd10c0766aa322bae780dbca48ebc33 Mon Sep 17 00:00:00 2001 From: Petter Reinholdtsen Date: Sun, 13 Oct 2013 22:55:24 +0200 Subject: [PATCH] Make code to avoid compiler warnings about uninitialized variables simpler. Fix some more. --- dna_helper.c | 2 +- overlay_mdp.c | 4 ++-- overlay_olsr.c | 2 +- vomp_console.c | 12 +++++++----- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/dna_helper.c b/dna_helper.c index a2962978..026c7f7e 100644 --- a/dna_helper.c +++ b/dna_helper.c @@ -88,7 +88,7 @@ static int dna_helper_started = 0; #define DECLARE_SCHED_ENT(FUNCTION, VARIABLE) \ static void FUNCTION(struct sched_ent *alarm); \ static struct profile_total VARIABLE##_timing={.name="" #FUNCTION "",._next=NULL,._initialised=0,.max_time=0,.total_time=0,.child_time=0,.calls=0}; \ -static struct sched_ent VARIABLE = {.function = FUNCTION, .stats = & VARIABLE##_timing, .poll={.fd=-1, .events=0,.revents=0}}; +static struct sched_ent VARIABLE = {.function = FUNCTION, .stats = & VARIABLE##_timing, .poll={.fd=-1}}; DECLARE_SCHED_ENT(monitor_requests, sched_requests); DECLARE_SCHED_ENT(monitor_replies, sched_replies); diff --git a/overlay_mdp.c b/overlay_mdp.c index 18cdbf27..36a78fc3 100644 --- a/overlay_mdp.c +++ b/overlay_mdp.c @@ -37,14 +37,14 @@ static struct profile_total mdp_stats = { .name="overlay_mdp_poll" }; static struct sched_ent mdp_sock = { .function = overlay_mdp_poll, .stats = &mdp_stats, - .poll={.fd = -1,.events=0,.revents=0}, + .poll={.fd = -1}, }; static struct profile_total mdp_stats2 = { .name="mdp_poll2" }; static struct sched_ent mdp_sock2 = { .function = mdp_poll2, .stats = &mdp_stats2, - .poll={.fd = -1,.events=0,.revents=0}, + .poll={.fd = -1}, }; static int overlay_saw_mdp_frame(struct overlay_frame *frame, overlay_mdp_frame *mdp, time_ms_t now); diff --git a/overlay_olsr.c b/overlay_olsr.c index cff3b420..92422124 100644 --- a/overlay_olsr.c +++ b/overlay_olsr.c @@ -48,7 +48,7 @@ static struct profile_total read_timing={ static struct sched_ent read_watch={ .function=olsr_read, .stats=&read_timing, - .poll={.fd=-1,.events=POLLIN,.revents=0}, + .poll={.fd=-1,.events=POLLIN}, }; int olsr_init_socket(void){ diff --git a/vomp_console.c b/vomp_console.c index a3ee4c05..1b8f09d3 100644 --- a/vomp_console.c +++ b/vomp_console.c @@ -330,17 +330,19 @@ int app_vomp_console(const struct cli_parsed *parsed, struct cli_context *contex .name="read_lines", }; struct line_state stdin_state={ - .alarm.poll.fd = STDIN_FILENO, - .alarm.poll.events = POLLIN, - .alarm.function = read_lines, - .alarm.stats=&stdin_profile, + .alarm = { + .poll = {.fd = STDIN_FILENO,.events = POLLIN}, + .function = read_lines, + .stats=&stdin_profile + }, + .fd=0, .process_line=console_command, }; static struct profile_total monitor_profile={ .name="monitor_read", }; struct sched_ent monitor_alarm={ - .poll.events = POLLIN, + .poll = {.fd = STDIN_FILENO,.events = POLLIN}, .function = monitor_read, .stats=&monitor_profile, };