Commit ed89498c authored by Robert Schmidt's avatar Robert Schmidt

Use standard C initializer list syntax

Fix clang warning

  warning: use of GNU old-style field designator extension [-Wgnu-designator]
parent 24baf08c
...@@ -164,7 +164,7 @@ index 0000000000..00baf34774 ...@@ -164,7 +164,7 @@ index 0000000000..00baf34774
+ } + }
+ +
+ /* a buffer needed to receive events from the nr-softmodem */ + /* a buffer needed to receive events from the nr-softmodem */
+ OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; + OBUF ebuf = { .osize = 0, .omaxsize = 0, .obuf = NULL };
+ +
+ /* read events */ + /* read events */
+ while (1) { + while (1) {
......
...@@ -874,7 +874,7 @@ int main(int n, char **v) ...@@ -874,7 +874,7 @@ int main(int n, char **v)
if (pthread_mutex_init(&enb_data.lock, NULL)) abort(); if (pthread_mutex_init(&enb_data.lock, NULL)) abort();
setup_event_selector(g, database, is_on, is_on_changed, &enb_data); setup_event_selector(g, database, is_on, is_on_changed, &enb_data);
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL};
restart: restart:
clear_remote_config(); clear_remote_config();
......
...@@ -49,7 +49,7 @@ again: ...@@ -49,7 +49,7 @@ again:
#endif #endif
read_error: read_error:
return (event){type: -1}; return (event){.type = -1};
} }
#ifdef T_SEND_TIME #ifdef T_SEND_TIME
......
...@@ -113,7 +113,7 @@ int main(int n, char **v) ...@@ -113,7 +113,7 @@ int main(int n, char **v)
found = 0; found = 0;
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL};
while (1) { while (1) {
event e; event e;
......
...@@ -36,7 +36,7 @@ int main(int n, char **v) ...@@ -36,7 +36,7 @@ int main(int n, char **v)
in = fopen(input_filename, "r"); in = fopen(input_filename, "r");
if (in == NULL) { perror(input_filename); abort(); } if (in == NULL) { perror(input_filename); abort(); }
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL};
while (1) { while (1) {
int type; int type;
......
...@@ -104,7 +104,7 @@ err: ...@@ -104,7 +104,7 @@ err:
fd = open(file, O_RDONLY); fd = open(file, O_RDONLY);
if (fd == -1) { perror(file); exit(1); } if (fd == -1) { perror(file); exit(1); }
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL};
/* get wanted frame/subframe */ /* get wanted frame/subframe */
while (1) { while (1) {
......
...@@ -101,7 +101,7 @@ err: ...@@ -101,7 +101,7 @@ err:
int last_subframe = -1; int last_subframe = -1;
int subframe_written = 0; int subframe_written = 0;
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL};
while (1) { while (1) {
event e; event e;
......
...@@ -265,7 +265,7 @@ int main(int n, char **v) ...@@ -265,7 +265,7 @@ int main(int n, char **v)
gnb_main_gui(&eg, g, h, database, &gnb_data); gnb_main_gui(&eg, g, h, database, &gnb_data);
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL};
restart: restart:
clear_remote_config(); clear_remote_config();
......
...@@ -85,7 +85,7 @@ int main(int n, char **v) { ...@@ -85,7 +85,7 @@ int main(int n, char **v) {
socket_send(socket, is_on, number_of_events * sizeof(int)) == -1) socket_send(socket, is_on, number_of_events * sizeof(int)) == -1)
abort(); abort();
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL};
char dump[10][T_BUFFER_MAX]; char dump[10][T_BUFFER_MAX];
event dump_ev[10]; event dump_ev[10];
FILE *z = fopen("/tmp/dd", "w"); FILE *z = fopen("/tmp/dd", "w");
......
...@@ -145,7 +145,7 @@ int main(int n, char **v) ...@@ -145,7 +145,7 @@ int main(int n, char **v)
clear_cache(number_of_tags, cache); clear_cache(number_of_tags, cache);
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL};
while (1) { while (1) {
int type; int type;
......
...@@ -86,7 +86,7 @@ int main(int n, char **v) ...@@ -86,7 +86,7 @@ int main(int n, char **v)
socket_send(socket, is_on, number_of_events * sizeof(int)) == -1) socket_send(socket, is_on, number_of_events * sizeof(int)) == -1)
abort(); abort();
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL};
while (1) { while (1) {
event e; event e;
......
...@@ -131,7 +131,7 @@ static struct chunk next_chunk(char **s, database_event_format f) ...@@ -131,7 +131,7 @@ static struct chunk next_chunk(char **s, database_event_format f)
cur++; cur++;
*s = cur; *s = cur;
if (find_argument(name, f, &it, &event_arg) == 0) goto error; if (find_argument(name, f, &it, &event_arg) == 0) goto error;
return (struct chunk){type:C_ARG_NAME, s:name, it:it, event_arg:event_arg}; return (struct chunk){.type = C_ARG_NAME, .s = name, .it = it, .event_arg = event_arg};
} }
/* { } is name of event (anything in between is smashed) */ /* { } is name of event (anything in between is smashed) */
...@@ -143,7 +143,7 @@ static struct chunk next_chunk(char **s, database_event_format f) ...@@ -143,7 +143,7 @@ static struct chunk next_chunk(char **s, database_event_format f)
*cur = 0; *cur = 0;
cur++; cur++;
*s = cur; *s = cur;
return (struct chunk){type:C_EVENT_NAME}; return (struct chunk){.type = C_EVENT_NAME};
} }
/* anything but [ and { is raw string */ /* anything but [ and { is raw string */
...@@ -151,10 +151,10 @@ static struct chunk next_chunk(char **s, database_event_format f) ...@@ -151,10 +151,10 @@ static struct chunk next_chunk(char **s, database_event_format f)
name = cur; name = cur;
while (*cur && *cur != '[' && *cur != '{') cur++; while (*cur && *cur != '[' && *cur != '{') cur++;
*s = cur; *s = cur;
return (struct chunk){type:C_STRING, s:name}; return (struct chunk){.type = C_STRING, .s = name};
error: error:
return (struct chunk){type:C_ERROR}; return (struct chunk){.type = C_ERROR};
} }
logger *new_textlog(event_handler *h, void *database, logger *new_textlog(event_handler *h, void *database,
......
...@@ -808,7 +808,7 @@ int main(int n, char **v) ...@@ -808,7 +808,7 @@ int main(int n, char **v)
d.to.sin_port = htons(port); d.to.sin_port = htons(port);
d.to.sin_addr.s_addr = inet_addr(ip); d.to.sin_addr.s_addr = inet_addr(ip);
new_thread(receiver, &d); new_thread(receiver, &d);
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL};
/* read messages */ /* read messages */
while (1) { while (1) {
......
...@@ -52,7 +52,7 @@ int send_messages_txt(int s, char *T_messages_txt, int T_messages_txt_len) ...@@ -52,7 +52,7 @@ int send_messages_txt(int s, char *T_messages_txt, int T_messages_txt_len)
/* TODO: be careful, we use internal T stuff, to rewrite? */ /* TODO: be careful, we use internal T stuff, to rewrite? */
T_LOCAL_size = 0; T_LOCAL_size = 0;
T_HEADER(T_ID(-1)); T_HEADER(T_ID(-1));
T_PUT_buffer(1, ((T_buffer){addr:(src), length:(send_size)})); T_PUT_buffer(1, ((T_buffer){.addr = src, .length = send_size}));
if (socket_send(s, &T_LOCAL_size, 4) == -1) return -1; if (socket_send(s, &T_LOCAL_size, 4) == -1) return -1;
if (socket_send(s, buf, T_LOCAL_size) == -1) return -1; if (socket_send(s, buf, T_LOCAL_size) == -1) return -1;
src += send_size; src += send_size;
...@@ -242,7 +242,7 @@ int main(int n, char **v) ...@@ -242,7 +242,7 @@ int main(int n, char **v)
/* create listener socket */ /* create listener socket */
l = create_listen_socket("0.0.0.0", local_port); l = create_listen_socket("0.0.0.0", local_port);
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL};
current_nfd = 0; current_nfd = 0;
......
...@@ -123,7 +123,7 @@ int main(int n, char **v) ...@@ -123,7 +123,7 @@ int main(int n, char **v)
if (signal(SIGINT, force_stop) == SIG_ERR) abort(); if (signal(SIGINT, force_stop) == SIG_ERR) abort();
if (signal(SIGTSTP, force_stop) == SIG_ERR) abort(); if (signal(SIGTSTP, force_stop) == SIG_ERR) abort();
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL};
/* read messages */ /* read messages */
while (run) { while (run) {
......
...@@ -136,7 +136,7 @@ int main(int n, char **v) ...@@ -136,7 +136,7 @@ int main(int n, char **v)
new_thread(get_message_thread, &socket); new_thread(get_message_thread, &socket);
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL};
while (1) { while (1) {
int type; int type;
......
...@@ -130,7 +130,7 @@ int main(int n, char **v) ...@@ -130,7 +130,7 @@ int main(int n, char **v)
/* send the first message - activate selected traces */ /* send the first message - activate selected traces */
activate_traces(socket, is_on, number_of_events); activate_traces(socket, is_on, number_of_events);
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL};
/* read messages */ /* read messages */
while (1) { while (1) {
......
...@@ -366,7 +366,7 @@ int main(int n, char **v) ...@@ -366,7 +366,7 @@ int main(int n, char **v)
if (signal(SIGINT, force_stop) == SIG_ERR) abort(); if (signal(SIGINT, force_stop) == SIG_ERR) abort();
if (signal(SIGTSTP, force_stop) == SIG_ERR) abort(); if (signal(SIGTSTP, force_stop) == SIG_ERR) abort();
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL};
/* read messages */ /* read messages */
while (run) { while (run) {
......
...@@ -758,7 +758,7 @@ int main(int n, char **v) ...@@ -758,7 +758,7 @@ int main(int n, char **v)
if (pthread_mutex_init(&ue_data.lock, NULL)) abort(); if (pthread_mutex_init(&ue_data.lock, NULL)) abort();
setup_event_selector(g, database, is_on, is_on_changed, &ue_data); setup_event_selector(g, database, is_on, is_on_changed, &ue_data);
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL};
restart: restart:
clear_remote_config(); clear_remote_config();
......
...@@ -187,7 +187,7 @@ int main(int n, char **v) ...@@ -187,7 +187,7 @@ int main(int n, char **v)
/* send the first message - activate selected traces */ /* send the first message - activate selected traces */
is_on_changed(&vcd_data); is_on_changed(&vcd_data);
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL};
/* read messages */ /* read messages */
while (1) { while (1) {
......
...@@ -129,8 +129,7 @@ static void *ticktime_thread(void *_this) ...@@ -129,8 +129,7 @@ static void *ticktime_thread(void *_this)
pixel_length = this->pixel_length; pixel_length = this->pixel_length;
if (this->autoscroll) { if (this->autoscroll) {
tnext = time_add(this->latest_time, tnext = time_add(this->latest_time, (struct timespec){.tv_sec = 0, .tv_nsec = 1});
(struct timespec){tv_sec:0,tv_nsec:1});
tstart = time_sub(tnext, nano_to_time(pixel_length * width)); tstart = time_sub(tnext, nano_to_time(pixel_length * width));
this->start_time = tstart; this->start_time = tstart;
} else { } else {
......
...@@ -122,8 +122,7 @@ static void *time_thread(void *_this) ...@@ -122,8 +122,7 @@ static void *time_thread(void *_this)
pixel_length = this->pixel_length; pixel_length = this->pixel_length;
if (this->autoscroll) { if (this->autoscroll) {
tnext = time_add(this->latest_time, tnext = time_add(this->latest_time, (struct timespec){.tv_sec = 0, .tv_nsec = 1});
(struct timespec){tv_sec:0,tv_nsec:1});
tstart = time_sub(tnext, nano_to_time(pixel_length * width)); tstart = time_sub(tnext, nano_to_time(pixel_length * width));
this->start_time = tstart; this->start_time = tstart;
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment