From 15a1e371682269fbfed2674cc2d76725ae3ca731 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 1 Jul 2013 11:29:06 +0200 Subject: dmesg: define is_timefmt() macro only once Signed-off-by: Karel Zak --- sys-utils/dmesg.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'sys-utils/dmesg.c') diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c index 2a28b6b74..c098323c2 100644 --- a/sys-utils/dmesg.c +++ b/sys-utils/dmesg.c @@ -136,7 +136,7 @@ enum { DMESG_TIMEFTM_TIME_DELTA, /* [time ] */ DMESG_TIMEFTM_ISO8601 /* 2013-06-13T22:11:00,123456+0100 */ }; -#define is_timefmt(c, f) (c->time_fmt == (DMESG_TIMEFTM_ ##f)) +#define is_timefmt(c, f) ((c)->time_fmt == (DMESG_TIMEFTM_ ##f)) struct dmesg_control { /* bit arrays -- see include/bitops.h */ @@ -1157,8 +1157,6 @@ static int which_time_format(const char *optarg) errx(EXIT_FAILURE, _("unknown time format: %s"), optarg); } -#undef is_timefmt -#define is_timefmt(c, f) (c.time_fmt == (DMESG_TIMEFTM_ ##f)) int main(int argc, char *argv[]) { char *buf = NULL; @@ -1337,7 +1335,10 @@ int main(int argc, char *argv[]) if (argc > 1) usage(stderr); - if (is_timefmt(ctl, RELTIME) || is_timefmt(ctl, CTIME) || is_timefmt(ctl, ISO8601)) { + if (is_timefmt(&ctl, RELTIME) || + is_timefmt(&ctl, CTIME) || + is_timefmt(&ctl, ISO8601)) { + ctl.boot_time = get_boot_time(); if (!ctl.boot_time) ctl.time_fmt = DMESG_TIMEFTM_NONE; @@ -1356,7 +1357,8 @@ int main(int argc, char *argv[]) } if (ctl.raw - && (ctl.fltr_lev || ctl.fltr_fac || ctl.decode || !is_timefmt(ctl, NONE))) + && (ctl.fltr_lev || ctl.fltr_fac || ctl.decode + || !is_timefmt(&ctl, NONE))) errx(EXIT_FAILURE, _("--raw can't be used together with level, " "facility, decode, delta, ctime or notime options")); -- cgit v1.2.3-55-g7522