From: Sami Kerola Date: Sat, 14 May 2016 15:40:45 +0000 (+0100) Subject: write: remove PUTC macro X-Git-Tag: v2.29-rc1~152^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8031743eaea418a9512c426f5678ea53e943ceb;p=thirdparty%2Futil-linux.git write: remove PUTC macro Function like macros make following the execution flow unnecessarily difficult, and deserves to be removed. Requested-by: Karel Zak Signed-off-by: Sami Kerola --- diff --git a/term-utils/write.c b/term-utils/write.c index 696a7a7953..40be5c2de4 100644 --- a/term-utils/write.c +++ b/term-utils/write.c @@ -220,18 +220,13 @@ static void signal_handler(int signo) */ static void write_line(char *s) { - char c; - -#define PUTC(c) if (fputc_careful(c, stdout, '^') == EOF) \ - err(EXIT_FAILURE, _("carefulputc failed")); while (*s) { - c = *s++; - if (c == '\n') - PUTC('\r'); - PUTC(c); + const int c = *s++; + + if ((c == '\n' && fputc_careful('\r', stdout, '^') == EOF) + || fputc_careful(c, stdout, '^') == EOF) + err(EXIT_FAILURE, _("carefulputc failed")); } - return; -#undef PUTC } /*