# HG changeset patch # User John "Elwin" Edwards # Date 1429625462 14400 # Node ID cfa9d1609b7876d55944e352a2aa7945185367f3 # Parent e6179860cb76813270dbb0f1ea3a722370058e33 xrogue: fix definition of struct delayed_action. Arrays of struct delayed_action were declared before the definition. Also, daemon.c and state.c defined it differently. The state.c definition, in which d_arg is a union, is now used everywhere. This is the least bad option, but fuses and daemons are still a disheartening morass that undoubtedly shelters more bugs. diff -r e6179860cb76 -r cfa9d1609b78 xrogue/daemon.c --- a/xrogue/daemon.c Tue Apr 21 08:55:20 2015 -0400 +++ b/xrogue/daemon.c Tue Apr 21 10:11:02 2015 -0400 @@ -24,12 +24,6 @@ #define _X_ { EMPTY } -struct delayed_action { - int d_type; - int (*d_func)(); - VOID *d_arg; - int d_time; -} ; struct delayed_action d_list[MAXDAEMONS] = { _X_, _X_, _X_, _X_, _X_, _X_, _X_, _X_, _X_, _X_ }; @@ -107,7 +101,7 @@ if (dev != NULL) { dev->d_type = type; dev->d_func = dfunc; - dev->d_arg = arg; + dev->d_arg.vp = arg; dev->d_time = DAEMON; demoncnt += 1; /* update count */ } @@ -133,7 +127,7 @@ * Take it out of the list */ dev->d_type = EMPTY; - dev->d_arg = NULL; + dev->d_arg.vp = NULL; dev->d_func = NULL; dev->d_time = 0; @@ -162,7 +156,7 @@ * Executing each one, giving it the proper arguments */ if ((dev->d_type == flag) && (dev->d_time == DAEMON) && (dev->d_func != NULL)) - (*dev->d_func)(dev->d_arg); + (*dev->d_func)(dev->d_arg.vp); } } @@ -181,7 +175,7 @@ if (wire != NULL) { wire->d_type = type; wire->d_func = dfunc; - wire->d_arg = arg; + wire->d_arg.vp = arg; wire->d_time = time; fusecnt += 1; /* update count */ } @@ -216,7 +210,7 @@ return; wire->d_type = EMPTY; wire->d_func = NULL; - wire->d_arg = NULL; + wire->d_arg.vp = NULL; wire->d_time = 0; fusecnt -= 1; } @@ -245,7 +239,7 @@ --wire->d_time == 0) { wire->d_type = EMPTY; if (wire->d_func != NULL) - (*wire->d_func)(wire->d_arg); + (*wire->d_func)(wire->d_arg.vp); fusecnt -= 1; } } diff -r e6179860cb76 -r cfa9d1609b78 xrogue/rogue.h --- a/xrogue/rogue.h Tue Apr 21 08:55:20 2015 -0400 +++ b/xrogue/rogue.h Tue Apr 21 10:11:02 2015 -0400 @@ -927,6 +927,16 @@ #define MAXDAEMONS 10 #define MAXFUSES 20 +struct delayed_action { + int d_type; + int (*d_func)(); + union { + VOID *vp; + int i; + } d_arg; + int d_time; +}; + extern struct delayed_action d_list[MAXDAEMONS]; extern struct delayed_action f_list[MAXFUSES]; extern int demoncnt; /* number of active daemons */ diff -r e6179860cb76 -r cfa9d1609b78 xrogue/state.c --- a/xrogue/state.c Tue Apr 21 08:55:20 2015 -0400 +++ b/xrogue/state.c Tue Apr 21 10:11:02 2015 -0400 @@ -959,16 +959,6 @@ return(READSTAT); } -struct delayed_action { - int d_type; - int (*d_func)(); - union { - VOID *vp; - int i; - } d_arg; - int d_time; -}; - rs_write_daemons(FILE *savef, struct delayed_action *d_list,int count) { int i = 0;