From: Sami Kerola Date: Sat, 17 Aug 2013 18:15:15 +0000 (+0100) Subject: last: prefer enum rather than #definition list X-Git-Tag: v2.24-rc1~338 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e843d047535b6523c16db8c37479f6fe29a50b72;p=thirdparty%2Futil-linux.git last: prefer enum rather than #definition list 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 --- diff --git a/login-utils/last.c b/login-utils/last.c index 276d13abd5..d561e962ee 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. */