[PATCH 10/16] last: prefer enum rather than #definition list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
 login-utils/last.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/login-utils/last.c b/login-utils/last.c
index 276d13a..d561e96 100644
--- a/login-utils/last.c
+++ b/login-utils/last.c
@@ -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. */
-- 
1.8.3.4

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux