Skip to content

Commit

Permalink
make struct initialization C99 compatible again
Browse files Browse the repository at this point in the history
Mainly change {} to { 0 } to remove a pedantic warning.

Signed-off-by: Rosen Penev <[email protected]>
  • Loading branch information
neheb authored and hartkopp committed Oct 14, 2020
1 parent d3b29df commit 204235c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion asc2log.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ void eval_canfd(char* buf, struct timeval *date_tvp, char timestamps, int dplace
int interface;
static struct timeval tv; /* current frame timestamp */
static struct timeval read_tv; /* frame timestamp from ASC file */
struct canfd_frame cf = {};
struct canfd_frame cf = { 0 };
unsigned char brs, esi, ctmp;
unsigned int flags;
int dlc, dlen = 0;
Expand Down
4 changes: 2 additions & 2 deletions cangw.c
Original file line number Diff line number Diff line change
Expand Up @@ -706,8 +706,8 @@ int main(int argc, char **argv)
struct can_filter filter;
struct sockaddr_nl nladdr;

struct cgw_csum_xor cs_xor = {};
struct cgw_csum_crc8 cs_crc8 = {};
struct cgw_csum_xor cs_xor = { 0 };
struct cgw_csum_crc8 cs_crc8 = { 0 };
char crc8tab[513] = {0};

struct modattr modmsg[CGW_MOD_FUNCS];
Expand Down
2 changes: 1 addition & 1 deletion j1939acd.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ static void install_signal(int sig)
static void schedule_itimer(int msec)
{
int ret;
struct itimerval val = {};
struct itimerval val = { 0 };

val.it_value.tv_sec = msec / 1000;
val.it_value.tv_usec = (msec % 1000) * 1000;
Expand Down
2 changes: 1 addition & 1 deletion testj1939.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static void onsigalrm(int sig)

static void schedule_oneshot_itimer(double delay)
{
struct itimerval it = {};
struct itimerval it = { 0 };

it.it_value.tv_sec = delay;
it.it_value.tv_usec = (long)(delay * 1e6) % 1000000;
Expand Down

0 comments on commit 204235c

Please sign in to comment.