]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
last: prefer enum rather than #definition list
authorSami Kerola <kerolasa@iki.fi>
Sat, 17 Aug 2013 18:15:15 +0000 (19:15 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 23 Aug 2013 08:58:59 +0000 (10:58 +0200)
Incremental number lists are more hard to get wrong with enum, and they
are nicer to debug as for example gdb is aware of these symbolic names.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
login-utils/last.c

index 276d13abd56e78772f85b14423b1310b143d8f86..d561e962ee0b0e60dab1ccab7e7d417d66a8d997 100644 (file)
@@ -64,13 +64,15 @@ struct utmplist {
 struct utmplist *utmplist = NULL;
 
 /* Types of listing */
-#define R_CRASH                1 /* No logout record, system boot in between */
-#define R_DOWN         2 /* System brought down in decent way */
-#define R_NORMAL       3 /* Normal */
-#define R_NOW          4 /* Still logged in */
-#define R_REBOOT       5 /* Reboot record. */
-#define R_PHANTOM      6 /* No logout record but session is stale. */
-#define R_TIMECHANGE   7 /* NEW_TIME or OLD_TIME */
+enum {
+       R_CRASH = 1,    /* No logout record, system boot in between */
+       R_DOWN,         /* System brought down in decent way */
+       R_NORMAL,       /* Normal */
+       R_NOW,          /* Still logged in */
+       R_REBOOT,       /* Reboot record. */
+       R_PHANTOM,      /* No logout record but session is stale. */
+       R_TIMECHANGE    /* NEW_TIME or OLD_TIME */
+};
 
 /* Global variables */
 static unsigned int maxrecs = 0; /* Maximum number of records to list. */