From a8031743eaea418a9512c426f5678ea53e943ceb Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 14 May 2016 16:40:45 +0100 Subject: 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 --- term-utils/write.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'term-utils/write.c') diff --git a/term-utils/write.c b/term-utils/write.c index 696a7a795..40be5c2de 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 } /* -- cgit v1.2.3-55-g7522