From 2a4e2f15af1a697152104af8f46f0ba6aab472ff Mon Sep 17 00:00:00 2001 From: Ralph Corderoy Date: Fri, 12 May 2017 23:29:31 +0100 Subject: [PATCH] Replace `a == b ? 1 : 0' and similar with `a == b'. --- sbr/datetime.c | 2 +- sbr/fmt_scan.c | 2 +- sbr/read_yes_or_no_if_tty.c | 2 +- sbr/utils.c | 2 +- uip/mhbuildsbr.c | 2 +- uip/mhfixmsg.c | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sbr/datetime.c b/sbr/datetime.c index 8b21e69b..a3e0e7a3 100644 --- a/sbr/datetime.c +++ b/sbr/datetime.c @@ -170,7 +170,7 @@ load_timezones (const contentline *clines) { if (in_standard) { in_standard = 0; } else if (in_daylight) { in_daylight = 0; } if (parse_datetime (params->dtstart, params->offsetfrom, - in_daylight ? 1 : 0, + in_daylight, &tws) == OK) { if (tws.tw_year >= 1970) { /* dmktime() falls apart for, e.g., the year 1601. */ diff --git a/sbr/fmt_scan.c b/sbr/fmt_scan.c index de7d8b78..39d549a5 100644 --- a/sbr/fmt_scan.c +++ b/sbr/fmt_scan.c @@ -470,7 +470,7 @@ fmt_scan (struct format *format, charstring_t scanlp, int width, int *dat, int num = value; unsigned int wid; - for (wid = num <= 0 ? 1 : 0; num; ++wid, num /= 10) {} + for (wid = num <= 0; num; ++wid, num /= 10) {} cpnumber (scanlp, value, wid, ' ', max - charstring_chars (scanlp)); break; diff --git a/sbr/read_yes_or_no_if_tty.c b/sbr/read_yes_or_no_if_tty.c index 05ffc2f6..2427f59c 100644 --- a/sbr/read_yes_or_no_if_tty.c +++ b/sbr/read_yes_or_no_if_tty.c @@ -14,7 +14,7 @@ read_yes_or_no_if_tty (const char *prompt) static int interactive = -1; if (interactive < 0) - interactive = isatty (fileno (stdin)) ? 1 : 0; + interactive = isatty (fileno (stdin)); return (interactive ? read_switch (prompt, anoyes) : 1); } diff --git a/sbr/utils.c b/sbr/utils.c index aa344b99..4c87b38a 100644 --- a/sbr/utils.c +++ b/sbr/utils.c @@ -533,7 +533,7 @@ nmh_version_changed (int older) { context_replace ("Version", "nmh-" VERSION); } - return old_version < current_version ? 1 : 0; + return old_version < current_version; } if (context_version == NULL || strcmp(context_version, "nmh-" VERSION) != 0) { diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index 62df410d..412f871e 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -1772,7 +1772,7 @@ skip_headers: */ if (checksw) { np = mh_xstrdup(MD5_FIELD); - vp = calculate_digest (ct, (ct->c_encoding == CE_QUOTED) ? 1 : 0); + vp = calculate_digest (ct, ct->c_encoding == CE_QUOTED); add_header (ct, np, vp); } diff --git a/uip/mhfixmsg.c b/uip/mhfixmsg.c index c4016f9e..acdb9d7a 100644 --- a/uip/mhfixmsg.c +++ b/uip/mhfixmsg.c @@ -2166,7 +2166,7 @@ content_encoding (CT ct, const char **reason) { encoding = CE_8BIT; } - last_char_was_cr = *cp == '\r' ? 1 : 0; + last_char_was_cr = *cp == '\r'; } } @@ -2249,7 +2249,7 @@ strip_crs (CT ct, int *message_mods) { break; } - last_char_was_cr = *cp == '\r' ? 1 : 0; + last_char_was_cr = *cp == '\r'; } } -- 2.56.0