comparison rogue4/daemon.c @ 215:1b73a8641b37

rogue4: fix most GCC5 warnings. Converting all function definitions to ANSI style accounts for most of the change. This has exposed other problems, such as daemons not actually being their stated type, that will require more careful solutions.
author John "Elwin" Edwards
date Wed, 27 Jan 2016 19:41:05 -0500
parents f2951c4e28d9
children b67b99f6c92b
comparison
equal deleted inserted replaced
214:e5a15b09ce1d 215:1b73a8641b37
27 /* 27 /*
28 * d_slot: 28 * d_slot:
29 * Find an empty slot in the daemon/fuse list 29 * Find an empty slot in the daemon/fuse list
30 */ 30 */
31 struct delayed_action * 31 struct delayed_action *
32 d_slot() 32 d_slot(void)
33 { 33 {
34 register int i; 34 register int i;
35 register struct delayed_action *dev; 35 register struct delayed_action *dev;
36 36
37 for (i = 0, dev = d_list; i < MAXDAEMONS; i++, dev++) 37 for (i = 0, dev = d_list; i < MAXDAEMONS; i++, dev++)
46 /* 46 /*
47 * find_slot: 47 * find_slot:
48 * Find a particular slot in the table 48 * Find a particular slot in the table
49 */ 49 */
50 struct delayed_action * 50 struct delayed_action *
51 find_slot(func) 51 find_slot(int (*func)())
52 register int (*func)();
53 { 52 {
54 register int i; 53 register int i;
55 register struct delayed_action *dev; 54 register struct delayed_action *dev;
56 55
57 for (i = 0, dev = d_list; i < MAXDAEMONS; i++, dev++) 56 for (i = 0, dev = d_list; i < MAXDAEMONS; i++, dev++)
62 61
63 /* 62 /*
64 * start_daemon: 63 * start_daemon:
65 * Start a daemon, takes a function. 64 * Start a daemon, takes a function.
66 */ 65 */
67 start_daemon(func, arg, type) 66 void
68 int (*func)(), arg, type; 67 start_daemon(int (*func)(), int arg, int type)
69 { 68 {
70 register struct delayed_action *dev; 69 register struct delayed_action *dev;
71 70
72 dev = d_slot(); 71 dev = d_slot();
73 dev->d_type = type; 72 dev->d_type = type;
78 77
79 /* 78 /*
80 * kill_daemon: 79 * kill_daemon:
81 * Remove a daemon from the list 80 * Remove a daemon from the list
82 */ 81 */
83 kill_daemon(func) 82 void
84 int (*func)(); 83 kill_daemon(int (*func)())
85 { 84 {
86 register struct delayed_action *dev; 85 register struct delayed_action *dev;
87 86
88 if ((dev = find_slot(func)) == NULL) 87 if ((dev = find_slot(func)) == NULL)
89 return; 88 return;
96 /* 95 /*
97 * do_daemons: 96 * do_daemons:
98 * Run all the daemons that are active with the current flag, 97 * Run all the daemons that are active with the current flag,
99 * passing the argument to the function. 98 * passing the argument to the function.
100 */ 99 */
101 do_daemons(flag) 100 void
102 register int flag; 101 do_daemons(int flag)
103 { 102 {
104 register struct delayed_action *dev; 103 register struct delayed_action *dev;
105 104
106 /* 105 /*
107 * Loop through the devil list 106 * Loop through the devil list
116 115
117 /* 116 /*
118 * fuse: 117 * fuse:
119 * Start a fuse to go off in a certain number of turns 118 * Start a fuse to go off in a certain number of turns
120 */ 119 */
121 fuse(func, arg, time, type) 120 void
122 int (*func)(), arg, time, type; 121 fuse(int (*func)(), int arg, int time, int type)
123 { 122 {
124 register struct delayed_action *wire; 123 register struct delayed_action *wire;
125 124
126 wire = d_slot(); 125 wire = d_slot();
127 wire->d_type = type; 126 wire->d_type = type;
132 131
133 /* 132 /*
134 * lengthen: 133 * lengthen:
135 * Increase the time until a fuse goes off 134 * Increase the time until a fuse goes off
136 */ 135 */
137 lengthen(func, xtime) 136 void
138 int (*func)(); 137 lengthen(int (*func)(), int xtime)
139 int xtime;
140 { 138 {
141 register struct delayed_action *wire; 139 register struct delayed_action *wire;
142 140
143 if ((wire = find_slot(func)) == NULL) 141 if ((wire = find_slot(func)) == NULL)
144 return; 142 return;
147 145
148 /* 146 /*
149 * extinguish: 147 * extinguish:
150 * Put out a fuse 148 * Put out a fuse
151 */ 149 */
152 extinguish(func) 150 void
153 int (*func)(); 151 extinguish(int (*func)())
154 { 152 {
155 register struct delayed_action *wire; 153 register struct delayed_action *wire;
156 154
157 if ((wire = find_slot(func)) == NULL) 155 if ((wire = find_slot(func)) == NULL)
158 return; 156 return;
161 159
162 /* 160 /*
163 * do_fuses: 161 * do_fuses:
164 * Decrement counters and start needed fuses 162 * Decrement counters and start needed fuses
165 */ 163 */
166 do_fuses(flag) 164 void
167 register int flag; 165 do_fuses(int flag)
168 { 166 {
169 register struct delayed_action *wire; 167 register struct delayed_action *wire;
170 168
171 /* 169 /*
172 * Step though the list 170 * Step though the list