Make code to avoid compiler warnings about uninitialized variables simpler. Fix some more.

This commit is contained in:
Petter Reinholdtsen 2013-10-13 22:55:24 +02:00
parent 3fd6cafe9f
commit fde6dc210f
4 changed files with 11 additions and 9 deletions

View File

@ -88,7 +88,7 @@ static int dna_helper_started = 0;
#define DECLARE_SCHED_ENT(FUNCTION, VARIABLE) \ #define DECLARE_SCHED_ENT(FUNCTION, VARIABLE) \
static void FUNCTION(struct sched_ent *alarm); \ 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 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_requests, sched_requests);
DECLARE_SCHED_ENT(monitor_replies, sched_replies); DECLARE_SCHED_ENT(monitor_replies, sched_replies);

View File

@ -37,14 +37,14 @@ static struct profile_total mdp_stats = { .name="overlay_mdp_poll" };
static struct sched_ent mdp_sock = { static struct sched_ent mdp_sock = {
.function = overlay_mdp_poll, .function = overlay_mdp_poll,
.stats = &mdp_stats, .stats = &mdp_stats,
.poll={.fd = -1,.events=0,.revents=0}, .poll={.fd = -1},
}; };
static struct profile_total mdp_stats2 = { .name="mdp_poll2" }; static struct profile_total mdp_stats2 = { .name="mdp_poll2" };
static struct sched_ent mdp_sock2 = { static struct sched_ent mdp_sock2 = {
.function = mdp_poll2, .function = mdp_poll2,
.stats = &mdp_stats2, .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); static int overlay_saw_mdp_frame(struct overlay_frame *frame, overlay_mdp_frame *mdp, time_ms_t now);

View File

@ -48,7 +48,7 @@ static struct profile_total read_timing={
static struct sched_ent read_watch={ static struct sched_ent read_watch={
.function=olsr_read, .function=olsr_read,
.stats=&read_timing, .stats=&read_timing,
.poll={.fd=-1,.events=POLLIN,.revents=0}, .poll={.fd=-1,.events=POLLIN},
}; };
int olsr_init_socket(void){ int olsr_init_socket(void){

View File

@ -330,17 +330,19 @@ int app_vomp_console(const struct cli_parsed *parsed, struct cli_context *contex
.name="read_lines", .name="read_lines",
}; };
struct line_state stdin_state={ struct line_state stdin_state={
.alarm.poll.fd = STDIN_FILENO, .alarm = {
.alarm.poll.events = POLLIN, .poll = {.fd = STDIN_FILENO,.events = POLLIN},
.alarm.function = read_lines, .function = read_lines,
.alarm.stats=&stdin_profile, .stats=&stdin_profile
},
.fd=0,
.process_line=console_command, .process_line=console_command,
}; };
static struct profile_total monitor_profile={ static struct profile_total monitor_profile={
.name="monitor_read", .name="monitor_read",
}; };
struct sched_ent monitor_alarm={ struct sched_ent monitor_alarm={
.poll.events = POLLIN, .poll = {.fd = STDIN_FILENO,.events = POLLIN},
.function = monitor_read, .function = monitor_read,
.stats=&monitor_profile, .stats=&monitor_profile,
}; };