diff xrogue/daemon.c @ 239:837044d2c362

Merge the GCC5 and build fix branches. This fixes all warnings produced by GCC 5, except the ones related to system functions. Those could be fixed by including the proper headers, but it would be better to replace the system-dependent code with functions from mdport.c.
author John "Elwin" Edwards
date Fri, 11 Mar 2016 19:47:52 -0500
parents e1cd27c5464f
children
line wrap: on
line diff
--- a/xrogue/daemon.c	Tue Mar 08 19:45:41 2016 -0500
+++ b/xrogue/daemon.c	Fri Mar 11 19:47:52 2016 -0500
@@ -74,7 +74,7 @@
  */
 
 struct delayed_action *
-find_slot(int (*func)())
+find_slot(void (*func)())
 {
         reg int i;
         reg struct delayed_action *dev;
@@ -91,7 +91,7 @@
  */
 
 void
-start_daemon(int (*dfunc)(), VOID *arg, int type)
+start_daemon(void (*dfunc)(), void *arg, int type)
 {
         reg struct delayed_action *dev;
 
@@ -111,7 +111,7 @@
  */
 
 void
-kill_daemon(int (*dfunc)())
+kill_daemon(void (*dfunc)())
 {
         reg struct delayed_action *dev;
         reg int i;
@@ -164,7 +164,7 @@
  */
 
 void
-fuse(int (*dfunc)(), VOID *arg, int time, int type)
+fuse(void (*dfunc)(), void *arg, int time, int type)
 {
         reg struct delayed_action *wire;
 
@@ -172,7 +172,10 @@
         if (wire != NULL) {
                 wire->d_type = type;
                 wire->d_func = dfunc;
-                wire->d_arg.vp = arg;
+                if (dfunc == changeclass || dfunc == res_strength)
+                        wire->d_arg.i = *(int *) arg;
+                else
+                        wire->d_arg.vp = arg;
                 wire->d_time = time;
                 fusecnt += 1;                   /* update count */
         }
@@ -184,7 +187,7 @@
  */
 
 void
-lengthen(int (*dfunc)(), int xtime)
+lengthen(void (*dfunc)(), int xtime)
 {
         reg struct delayed_action *wire;
 
@@ -199,7 +202,7 @@
  */
 
 void
-extinguish(int (*dfunc)())
+extinguish(void (*dfunc)())
 {
         reg struct delayed_action *wire;
 
@@ -220,26 +223,28 @@
 void
 do_fuses(int flag)
 {
-        struct delayed_action *wire;
-        int i;
+    struct delayed_action *wire;
+    int i;
 
-        /*
-         * Step though the list
-         */
-        for (i = 0; i < MAXFUSES; i++) {
-            wire = &f_list[i];
+    /*
+     * Step though the list
+     */
+    for (i = 0; i < MAXFUSES; i++) {
+        wire = &f_list[i];
         /*
          * Decrementing counters and starting things we want.  We also need
          * to remove the fuse from the list once it has gone off.
          */
-            if(flag == wire->d_type && wire->d_time > 0 &&
+        if(flag == wire->d_type && wire->d_time > 0 &&
               --wire->d_time == 0) {
-                wire->d_type = EMPTY;
-				if (wire->d_func != NULL)
-					(*wire->d_func)(wire->d_arg.vp);
-                fusecnt -= 1;
-            }
+            wire->d_type = EMPTY;
+            if (*wire->d_func == changeclass || *wire->d_func == res_strength)
+                (*wire->d_func)(wire->d_arg.i);
+            else if (wire->d_func != NULL)
+                (*wire->d_func)(wire->d_arg.vp);
+            fusecnt -= 1;
         }
+    }
 }
 
 /*