Make the list of phases be an enumeration.
authorRichard Kettlewell <rjk@terraraq.org.uk>
Sat, 10 Dec 2011 22:35:47 +0000 (22:35 +0000)
committerRichard Kettlewell <rjk@terraraq.org.uk>
Sat, 10 Dec 2011 22:35:47 +0000 (22:35 +0000)
Signed-off-by: Richard Kettlewell <rjk@terraraq.org.uk>
secnet.h

index fbb7660..e7eb161 100644 (file)
--- a/secnet.h
+++ b/secnet.h
@@ -186,15 +186,18 @@ extern void register_for_poll(void *st, beforepoll_fn *before,
    Module code may arrange to be called just as various phases are
    entered. */
 
-#define PHASE_INIT          0
-#define PHASE_GETOPTS       1  /* Process command-line arguments */
-#define PHASE_READCONFIG    2  /* Parse and process configuration file */
-#define PHASE_SETUP         3  /* Process information in configuration */
-#define PHASE_GETRESOURCES  4  /* Obtain all external resources */
-#define PHASE_DROPPRIV      5  /* Last chance for privileged operations */
-#define PHASE_RUN           6
-#define PHASE_SHUTDOWN      7  /* About to die; delete key material, etc. */
-#define NR_PHASES           8
+enum phase {
+    PHASE_INIT,
+    PHASE_GETOPTS,             /* Process command-line arguments */
+    PHASE_READCONFIG,          /* Parse and process configuration file */
+    PHASE_SETUP,               /* Process information in configuration */
+    PHASE_GETRESOURCES,        /* Obtain all external resources */
+    PHASE_DROPPRIV,            /* Last chance for privileged operations */
+    PHASE_RUN,
+    PHASE_SHUTDOWN,            /* About to die; delete key material, etc. */
+    /* Keep this last: */
+    NR_PHASES,
+};
 
 typedef void hook_fn(void *self, uint32_t newphase);
 bool_t add_hook(uint32_t phase, hook_fn *f, void *state);