changeset 236:7c1cb43f346e

XRogue: get rid of VOID as an alias for long. Maybe some compilers in 1986 didn't handle void pointers well, but they are no longer a concern.
author John "Elwin" Edwards
date Mon, 07 Mar 2016 20:44:01 -0500
parents 2dcf10d45d5b
children 2236ef808bcb
files xrogue/bolt.c xrogue/command.c xrogue/daemon.c xrogue/daemons.c xrogue/eat.c xrogue/effects.c xrogue/encumb.c xrogue/fight.c xrogue/main.c xrogue/misc.c xrogue/monsters.c xrogue/pack.c xrogue/potions.c xrogue/rings.c xrogue/rogue.h xrogue/state.c xrogue/sticks.c xrogue/util.c xrogue/wear.c
diffstat 19 files changed, 57 insertions(+), 62 deletions(-) [+]
line wrap: on
line diff
--- a/xrogue/bolt.c	Mon Mar 07 19:26:08 2016 -0500
+++ b/xrogue/bolt.c	Mon Mar 07 20:44:01 2016 -0500
@@ -341,7 +341,7 @@
                                                  rnd(20)+HUHDURATION);
                                     else {
                                         turn_on(player, ISHUH);
-                                        fuse(unconfuse, (VOID *)NULL,
+                                        fuse(unconfuse, NULL,
                                              rnd(20)+HUHDURATION, AFTER);
                                         msg("The confusion gas has confused you.");
                                     }
--- a/xrogue/command.c	Mon Mar 07 19:26:08 2016 -0500
+++ b/xrogue/command.c	Mon Mar 07 20:44:01 2016 -0500
@@ -693,7 +693,7 @@
      * Reset the signal in case we got here via an interrupt
      */
 
-    if ((VOID(*)())signal(SIGINT, quit) != (VOID(*)())quit)
+    if (signal(SIGINT, quit) != quit)
         mpos = 0;
 
     getyx(cw, oy, ox);
--- a/xrogue/daemon.c	Mon Mar 07 19:26:08 2016 -0500
+++ b/xrogue/daemon.c	Mon Mar 07 20:44:01 2016 -0500
@@ -91,7 +91,7 @@
  */
 
 void
-start_daemon(void (*dfunc)(), VOID *arg, int type)
+start_daemon(void (*dfunc)(), void *arg, int type)
 {
         reg struct delayed_action *dev;
 
@@ -164,7 +164,7 @@
  */
 
 void
-fuse(void (*dfunc)(), VOID *arg, int time, int type)
+fuse(void (*dfunc)(), void *arg, int time, int type)
 {
         reg struct delayed_action *wire;
 
--- a/xrogue/daemons.c	Mon Mar 07 19:26:08 2016 -0500
+++ b/xrogue/daemons.c	Mon Mar 07 20:44:01 2016 -0500
@@ -114,7 +114,7 @@
 void
 swander(void)
 {
-    start_daemon(rollwand, (VOID *)NULL, BEFORE);
+    start_daemon(rollwand, NULL, BEFORE);
 }
 
 /*
@@ -137,7 +137,7 @@
             if (levtype != POSTLEV)
                 wanderer();
             kill_daemon(rollwand);
-            fuse(swander, (VOID *)NULL, WANDERTIME, BEFORE);
+            fuse(swander, NULL, WANDERTIME, BEFORE);
         }
         between = 0;
     }
@@ -612,7 +612,7 @@
         return;
     if (tobj->o_charges < QUILLCHARGES)
         tobj->o_charges++;
-    fuse (quill_charge, (VOID *)NULL, player.t_ctype == C_MAGICIAN ? 4 : 8, AFTER);
+    fuse (quill_charge, NULL, player.t_ctype == C_MAGICIAN ? 4 : 8, AFTER);
 }
 
 /*
@@ -719,7 +719,7 @@
     time = SPELLTIME - max(17-pstats.s_intel, 0);
     time = max(time, 5);
     if (spell_power > 0) spell_power--;
-    fuse(spell_recovery, (VOID *)NULL, time, AFTER);
+    fuse(spell_recovery, NULL, time, AFTER);
 }
 
 /*
@@ -734,7 +734,7 @@
     time = SPELLTIME - max(17-pstats.s_wisdom, 0);
     time = max(time, 5);
     if (pray_time > 0) pray_time--;
-    fuse(prayer_recovery, (VOID *)NULL, time, AFTER);
+    fuse(prayer_recovery, NULL, time, AFTER);
 }
 
 /*
@@ -749,6 +749,6 @@
     time = SPELLTIME - max(17-pstats.s_wisdom, 0);
     time = max(time, 5);
     if (chant_time > 0) chant_time--;
-    fuse(chant_recovery, (VOID *)NULL, time, AFTER);
+    fuse(chant_recovery, NULL, time, AFTER);
 }
 
--- a/xrogue/eat.c	Mon Mar 07 19:26:08 2016 -0500
+++ b/xrogue/eat.c	Mon Mar 07 20:44:01 2016 -0500
@@ -153,7 +153,7 @@
             }
             else {
                 turn_on(player, HASDISEASE);
-                fuse(cure_disease, (VOID *)NULL, roll(HEALTIME,SICKTIME),AFTER);
+                fuse(cure_disease, NULL, roll(HEALTIME,SICKTIME),AFTER);
                 msg("You become ill. ");
             }
     }
--- a/xrogue/effects.c	Mon Mar 07 19:26:08 2016 -0500
+++ b/xrogue/effects.c	Mon Mar 07 20:44:01 2016 -0500
@@ -309,7 +309,7 @@
                     if (on(player, HASSTINK)) lengthen(unstink, STINKTIME);
                     else {
                         turn_on(player, HASSTINK);
-                        fuse(unstink, (VOID *)NULL, STINKTIME, AFTER);
+                        fuse(unstink, NULL, STINKTIME, AFTER);
                     }
                 }
             }
@@ -324,7 +324,7 @@
                                 prname(attname, FALSE));
                     chg_str(-1);
                     if (lost_str++ == 0)
-                        fuse(res_strength, (VOID *)NULL, CHILLTIME, AFTER);
+                        fuse(res_strength, NULL, CHILLTIME, AFTER);
                     else lengthen(res_strength, CHILLTIME);
                 }
             }
@@ -359,7 +359,7 @@
                     }
                     else {
                         turn_on(*def, HASDISEASE);
-                        fuse(cure_disease, (VOID *)NULL, roll(HEALTIME,SICKTIME), AFTER);
+                        fuse(cure_disease, NULL, roll(HEALTIME,SICKTIME), AFTER);
                         msg(terse ? "You have been diseased!"
                             : "You have contracted an annoying disease!");
                     }
@@ -491,7 +491,7 @@
                     turn_off(*att, CANDANCE);
                     turn_on(*def, ISDANCE);
                     msg("You begin to dance uncontrollably!");
-                    fuse(undance, (VOID *)NULL, roll(2,4), AFTER);
+                    fuse(undance, NULL, roll(2,4), AFTER);
             }
 
             /*
@@ -504,7 +504,7 @@
                 (find_slot(suffocate) == 0)) {
                 turn_on(*att, DIDSUFFOCATE);
                 msg("%s is beginning to suffocate you!", prname(attname, TRUE));
-                fuse(suffocate, (VOID *)NULL, roll(9,3), AFTER);
+                fuse(suffocate, NULL, roll(9,3), AFTER);
             }
 
             /*
@@ -552,7 +552,7 @@
                     msg("You are overcome by a foul odor!");
                     if (lost_str == 0) {
                         chg_str(odor_str);
-                        fuse(res_strength, (VOID *)NULL, SMELLTIME, AFTER);
+                        fuse(res_strength, NULL, SMELLTIME, AFTER);
                         lost_str -= odor_str;
                     }
                     else lengthen(res_strength, SMELLTIME);
--- a/xrogue/encumb.c	Mon Mar 07 19:26:08 2016 -0500
+++ b/xrogue/encumb.c	Mon Mar 07 20:44:01 2016 -0500
@@ -169,7 +169,7 @@
             ch = mvwinch(stdscr, hero.y, hero.x);
             if((ch != FLOOR && ch != PASSAGE)) {
                 extinguish(wghtchk);
-                fuse(wghtchk, (VOID *)NULL, 1, AFTER);
+                fuse(wghtchk, NULL, 1, AFTER);
                 inwhgt = FALSE;
                 return;
             }
--- a/xrogue/fight.c	Mon Mar 07 19:26:08 2016 -0500
+++ b/xrogue/fight.c	Mon Mar 07 20:44:01 2016 -0500
@@ -564,7 +564,7 @@
                         if (find_slot(unconfuse))
                             lengthen(unconfuse, HUHDURATION);
                         else
-                            fuse(unconfuse, (VOID *)NULL, HUHDURATION, AFTER);
+                            fuse(unconfuse, NULL, HUHDURATION, AFTER);
                         turn_on(player, ISHUH);
                     }
                     else msg("You feel dizzy, but it quickly passes.");
--- a/xrogue/main.c	Mon Mar 07 19:26:08 2016 -0500
+++ b/xrogue/main.c	Mon Mar 07 20:44:01 2016 -0500
@@ -244,19 +244,19 @@
      * Start up daemons and fuses
      */
     start_daemon(doctor, &player, AFTER);
-    fuse(swander, (VOID *)NULL, WANDERTIME, AFTER);
+    fuse(swander, NULL, WANDERTIME, AFTER);
     /* Give characters their innate abilities */
     if (player.t_ctype == C_MAGICIAN || player.t_ctype == C_RANGER)
-            fuse(spell_recovery, (VOID *)NULL, SPELLTIME, AFTER);
+            fuse(spell_recovery, NULL, SPELLTIME, AFTER);
     if (player.t_ctype == C_DRUID    || player.t_ctype == C_MONK)
-            fuse(chant_recovery, (VOID *)NULL, SPELLTIME, AFTER);
+            fuse(chant_recovery, NULL, SPELLTIME, AFTER);
     if (player.t_ctype == C_CLERIC   || player.t_ctype == C_PALADIN)
-            fuse(prayer_recovery, (VOID *)NULL, SPELLTIME, AFTER);
-    start_daemon(stomach, (VOID *)NULL, AFTER);
+            fuse(prayer_recovery, NULL, SPELLTIME, AFTER);
+    start_daemon(stomach, NULL, AFTER);
     if (player.t_ctype == C_THIEF    ||
         player.t_ctype == C_ASSASSIN ||
         player.t_ctype == C_MONK)
-            start_daemon(trap_look, (VOID *)NULL, AFTER);
+            start_daemon(trap_look, NULL, AFTER);
 
     /* Does this character have any special knowledge? */
     switch (player.t_ctype) {
--- a/xrogue/misc.c	Mon Mar 07 19:26:08 2016 -0500
+++ b/xrogue/misc.c	Mon Mar 07 20:44:01 2016 -0500
@@ -82,11 +82,11 @@
          * if he becomes a spell caster of some kind, give him a fuse
          */
         if (*newclass == C_MAGICIAN || *newclass == C_RANGER)
-                fuse(spell_recovery, (VOID *)NULL, SPELLTIME, AFTER);
+                fuse(spell_recovery, NULL, SPELLTIME, AFTER);
         if (*newclass == C_DRUID || *newclass == C_MONK)
-                fuse(chant_recovery, (VOID *)NULL, SPELLTIME, AFTER);
+                fuse(chant_recovery, NULL, SPELLTIME, AFTER);
         if ((*newclass==C_CLERIC || *newclass==C_PALADIN) && !cur_misc[HEIL_ANKH])
-                fuse(prayer_recovery, (VOID *)NULL, SPELLTIME, AFTER);
+                fuse(prayer_recovery, NULL, SPELLTIME, AFTER);
         /*
          * if he's changing from a fighter, ranger, or paladin then we
      * may have to change his sword since only these types can wield
@@ -132,7 +132,7 @@
          */
         if (*newclass == C_THIEF || *newclass == C_ASSASSIN ||
         *newclass == C_MONK)
-                start_daemon(trap_look, (VOID *)NULL, AFTER);
+                start_daemon(trap_look, NULL, AFTER);
 
     /* adjust stats */
         char_type = player.t_ctype = *newclass;
@@ -1029,7 +1029,7 @@
             else msg("Ahh.. Ahh... Choo!! ");
             if (!find_slot(dust_appear)) {
                 turn_on(player, ISINVIS);
-                fuse(dust_appear, (VOID *)NULL, DUSTTIME, AFTER);
+                fuse(dust_appear, NULL, DUSTTIME, AFTER);
                 PLAYER = IPLAYER;
                 light(&hero);
             }
@@ -1059,7 +1059,7 @@
                 if (find_slot(unchoke))
                     lengthen(unchoke, DUSTTIME);
                 else
-                    fuse(unchoke, (VOID *)NULL, DUSTTIME, AFTER);
+                    fuse(unchoke, NULL, DUSTTIME, AFTER);
                 turn_on(player, ISHUH);
                 turn_on(player, ISBLIND);
                 light(&hero);
--- a/xrogue/monsters.c	Mon Mar 07 19:26:08 2016 -0500
+++ b/xrogue/monsters.c	Mon Mar 07 20:44:01 2016 -0500
@@ -685,7 +685,7 @@
                     if (find_slot(unconfuse))
                         lengthen(unconfuse, HUHDURATION);
                     else {
-                        fuse(unconfuse, (VOID *)NULL, HUHDURATION, AFTER);
+                        fuse(unconfuse, NULL, HUHDURATION, AFTER);
                         msg("%s's gaze has confused you.",prname(mname, TRUE));
                         turn_on(player, ISHUH);
                     }
@@ -727,7 +727,7 @@
             if (!save(VS_WAND, &player, 0)) {
                 msg("The gaze of %s blinds you! ", prname(mname, FALSE));
                 turn_on(player, ISBLIND);
-                fuse(sight, (VOID *)NULL, rnd(30)+20, AFTER);
+                fuse(sight, NULL, rnd(30)+20, AFTER);
                 light(&hero);
             }
         }
--- a/xrogue/pack.c	Mon Mar 07 19:26:08 2016 -0500
+++ b/xrogue/pack.c	Mon Mar 07 20:44:01 2016 -0500
@@ -259,7 +259,7 @@
             case HEIL_ANKH:
                 msg("The ankh welds itself into your hand. ");
                 if (player.t_ctype != C_CLERIC && player.t_ctype != C_PALADIN)
-                    fuse(prayer_recovery, (VOID *)NULL, SPELLTIME, AFTER);
+                    fuse(prayer_recovery, NULL, SPELLTIME, AFTER);
         /* start a fuse to change player into a paladin */
         if (quest_item != HEIL_ANKH) {
             msg("You hear a strange, distant hypnotic calling... ");
@@ -336,7 +336,7 @@
         }
                 
             when QUILL_NAGROM:
-                fuse(quill_charge,(VOID *)NULL, 8, AFTER);
+                fuse(quill_charge, NULL, 8, AFTER);
         /* start a fuse to change player into a druid */
         if (quest_item != QUILL_NAGROM) {
             msg("You begin to see things differently... ");
--- a/xrogue/potions.c	Mon Mar 07 19:26:08 2016 -0500
+++ b/xrogue/potions.c	Mon Mar 07 20:44:01 2016 -0500
@@ -172,7 +172,7 @@
     else {
         msg("You feel yourself moving %sfaster.", blessed ? "much " : "");
         turn_on(player, ISHASTE);
-        fuse(nohaste, (VOID *)NULL, roll(hasttime, hasttime), AFTER);
+        fuse(nohaste, NULL, roll(hasttime, hasttime), AFTER);
     }
 }
 
@@ -232,7 +232,7 @@
             lengthen(noslow, roll(HASTETIME,HASTETIME));
         else {
             turn_on(player, ISSLOW);
-            fuse(noslow, (VOID *)NULL, roll(HASTETIME,HASTETIME), AFTER);
+            fuse(noslow, NULL, roll(HASTETIME,HASTETIME), AFTER);
         }
     }
 }
@@ -353,7 +353,7 @@
                 }
                 else {  /* Just light a fuse for how long player is safe */
                     if (off(player, ISCLEAR)) {
-                        fuse(unclrhead, (VOID *)NULL, CLRDURATION, AFTER);
+                        fuse(unclrhead, NULL, CLRDURATION, AFTER);
                         msg("A faint blue aura surrounds your head.");
                     }
                     else {  /* If we have a fuse lengthen it, else we
@@ -518,7 +518,7 @@
                 {
                     msg("A cloak of darkness falls around you.");
                     turn_on(player, ISBLIND);
-                    fuse(sight, (VOID *)NULL, SEEDURATION, AFTER);
+                    fuse(sight, NULL, SEEDURATION, AFTER);
                     light(&hero);
                 }
                 else
@@ -529,7 +529,7 @@
                 if (off(player, CANSEE)) {
                     turn_on(player, CANSEE);
                     msg("Your eyes begin to tingle.");
-                    fuse(unsee, (VOID *)NULL, blessed ? SEEDURATION*3 :SEEDURATION, AFTER);
+                    fuse(unsee, NULL, blessed ? SEEDURATION*3 :SEEDURATION, AFTER);
                     light(&hero);
                 }
                 else if (find_slot(unsee) != 0) {
@@ -553,7 +553,7 @@
                 if (on(player, CANINWALL))
                     lengthen(unphase, duration*PHASEDURATION);
                 else {
-                    fuse(unphase, (VOID *)NULL, duration*PHASEDURATION, AFTER);
+                    fuse(unphase, NULL, duration*PHASEDURATION, AFTER);
                     turn_on(player, CANINWALL);
                 }
                 msg("You feel %slight-headed!",
@@ -577,7 +577,7 @@
                 }
             }
             else {
-                fuse(land, (VOID *)NULL, duration*FLYTIME, AFTER);
+                fuse(land, NULL, duration*FLYTIME, AFTER);
                 turn_on(player, ISFLY);
             }
             if (say_message) {
@@ -641,7 +641,7 @@
             if (off(player, ISINVIS)) {
                 turn_on(player, ISINVIS);
                 msg("You have a tingling feeling all over your body");
-                fuse(appear, (VOID *)NULL, blessed ? GONETIME*3 : GONETIME, AFTER);
+                fuse(appear, NULL, blessed ? GONETIME*3 : GONETIME, AFTER);
                 PLAYER = IPLAYER;
                 light(&hero);
             }
@@ -703,7 +703,7 @@
                 if (!find_slot(unskill)) {      /* No skill */
                     pstats.s_lvladj = -2;
                     pstats.s_lvl += pstats.s_lvladj;
-                    fuse(unskill, (VOID *)NULL, SKILLDURATION, AFTER);
+                    fuse(unskill, NULL, SKILLDURATION, AFTER);
                 }
                 else {  /* Has an artifical skill */
                     /* Is the skill beneficial? */
@@ -759,7 +759,7 @@
                 if (!find_slot(unskill)) {
                     pstats.s_lvladj = adjust;
                     pstats.s_lvl += pstats.s_lvladj;
-                    fuse(unskill, (VOID *)NULL, 
+                    fuse(unskill, NULL, 
                          blessed ? SKILLDURATION*2 : SKILLDURATION, AFTER);
                 }
                 else {  /* Has an artifical skill */
@@ -819,7 +819,7 @@
         say_message = FALSE;
         }
             else {
-                fuse(nofire, (VOID *)NULL, duration*FIRETIME, AFTER);
+                fuse(nofire, NULL, duration*FIRETIME, AFTER);
                 turn_on(player, NOFIRE);
             }
             if (say_message)  {
@@ -856,7 +856,7 @@
         say_message = FALSE;
         }
             else {
-                fuse(nocold, (VOID *)NULL, duration*COLDTIME, AFTER);
+                fuse(nocold, NULL, duration*COLDTIME, AFTER);
                 turn_on(player, NOCOLD);
             }
             if (say_message)  {
@@ -890,7 +890,7 @@
         say_message = FALSE;
         }
             else {
-                fuse(nobolt, (VOID *)NULL, duration*BOLTTIME, AFTER);
+                fuse(nobolt, NULL, duration*BOLTTIME, AFTER);
                 turn_on(player, NOBOLT);
             }
             if (say_message) {
--- a/xrogue/rings.c	Mon Mar 07 19:26:08 2016 -0500
+++ b/xrogue/rings.c	Mon Mar 07 20:44:01 2016 -0500
@@ -100,9 +100,9 @@
             }
     }
         when R_SEARCH:
-            start_daemon(ring_search, (VOID *)NULL, AFTER);
+            start_daemon(ring_search, NULL, AFTER);
         when R_TELEPORT:
-            start_daemon(ring_teleport, (VOID *)NULL, AFTER);
+            start_daemon(ring_teleport, NULL, AFTER);
     }
     status(FALSE);
     if (r_know[obj->o_which] && r_guess[obj->o_which]) {
--- a/xrogue/rogue.h	Mon Mar 07 19:26:08 2016 -0500
+++ b/xrogue/rogue.h	Mon Mar 07 20:44:01 2016 -0500
@@ -20,12 +20,8 @@
 #include "config.h"
 #endif
 
-/*
- * some compiler don't handle void pointers well so
- */
 #include <assert.h>
 #define reg  register
-#define VOID long
 #undef lines
 #define ENCREAD encread
 #define ENCWRITE encwrite
@@ -935,7 +931,7 @@
     int d_type;
     void (*d_func)();
 	union {
-		VOID *vp;
+		void *vp;
 		int  i;
 	} d_arg;
     int d_time;
@@ -1322,7 +1318,7 @@
 void    fix_stick(struct object *cur);
 void    fright(struct thing *th);
 void    fumble(void);
-void    fuse(void (*dfunc)(), VOID *arg, int time, int type);
+void    fuse(void (*dfunc)(), void *arg, int time, int type);
 void    genmonsters(int least, bool treas);
 coord   get_coordinates(void);
 bool    get_dir(coord *direction);
@@ -1452,7 +1448,7 @@
                  bool thrown);
 struct linked_list *spec_item(int type, int which, int hit, int damage);
 void    spell_recovery(void);
-void    start_daemon(void (*dfunc)(), VOID *arg, int type);
+void    start_daemon(void (*dfunc)(), void *arg, int type);
 void    status(bool display);
 void    steal(void);
 bool    step_ok(int y, int x, int can_on_monst, struct thing *flgptr);
--- a/xrogue/state.c	Mon Mar 07 19:26:08 2016 -0500
+++ b/xrogue/state.c	Mon Mar 07 20:44:01 2016 -0500
@@ -57,7 +57,6 @@
 #include <Lmcons.h>
 #include <shlobj.h>
 #include <Shlwapi.h>
-#undef VOID
 #undef MOUSE_MOVED
 #elif defined(__DJGPP__)
 #include <process.h>
--- a/xrogue/sticks.c	Mon Mar 07 19:26:08 2016 -0500
+++ b/xrogue/sticks.c	Mon Mar 07 20:44:01 2016 -0500
@@ -613,7 +613,7 @@
                     turn_on(player, HASDISEASE);
                     turn_on(player, HASINFEST);
                     turn_on(player, DOROT);
-                    fuse(cure_disease, (VOID *)NULL, roll(HEALTIME,SICKTIME), AFTER);
+                    fuse(cure_disease, NULL, roll(HEALTIME,SICKTIME), AFTER);
                     infest_dam++;
                 }
         else if (sick == FALSE) msg("You feel momentarily sick");
--- a/xrogue/util.c	Mon Mar 07 19:26:08 2016 -0500
+++ b/xrogue/util.c	Mon Mar 07 20:44:01 2016 -0500
@@ -203,7 +203,7 @@
         if (find_slot(unconfuse))
             lengthen(unconfuse, HUHDURATION);
         else
-            fuse(unconfuse, (VOID *)NULL, HUHDURATION, AFTER);
+            fuse(unconfuse, NULL, HUHDURATION, AFTER);
         turn_on(player, ISHUH);
     }
     else msg("You feel dizzy for a moment, but it quickly passes.");
--- a/xrogue/wear.c	Mon Mar 07 19:26:08 2016 -0500
+++ b/xrogue/wear.c	Mon Mar 07 20:44:01 2016 -0500
@@ -328,7 +328,7 @@
                 msg("Wearing %s", inv_name(obj,TRUE));
                 cur_misc[WEAR_GAUNTLET] = obj;
                 if (obj->o_which == MM_FUMBLE)
-                    start_daemon(fumble, (VOID *)NULL, AFTER);
+                    start_daemon(fumble, NULL, AFTER);
             /*
              * the jewel of attacks does an aggavate monster
              */
@@ -358,7 +358,7 @@
                 msg("Wearing %s",inv_name(obj,TRUE));
                 cur_misc[WEAR_NECKLACE] = obj;
                 msg("The necklace is beginning to strangle you!");
-                start_daemon(strangle, (VOID *)NULL, AFTER);
+                start_daemon(strangle, NULL, AFTER);
             otherwise:
                 msg("What a strange item you have!");
             }