From: Simon Ruderich Date: Sun, 30 Jun 2013 20:14:33 +0000 (+0200) Subject: Also hook un-macroed putc when it's a macro. X-Git-Tag: 0.1~16 X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=d49cd5d92a07d708ddcb3c29cad67403cf8eb836;p=coloredstderr%2Fcoloredstderr.git Also hook un-macroed putc when it's a macro. The macro might define it to something else, but the non-macro version is also used in some cases, e.g. in gcc 4.8's collect2 on Debian with eglibc 2.17-7. --- diff --git a/src/coloredstderr.c b/src/coloredstderr.c index a78fdd9..66467b4 100644 --- a/src/coloredstderr.c +++ b/src/coloredstderr.c @@ -238,6 +238,14 @@ HOOK_FILE2(int, fputc, stream, int, c, FILE *, stream) HOOK_FILE2(int, putc, stream, int, c, FILE *, stream) +/* The glibc uses a macro for putc() which expands to _IO_putc(). However + * sometimes the raw putc() is used as well, not sure why. Make sure to hook + * it too. */ +#ifdef putc +# undef putc +HOOK_FILE2(int, putc, stream, + int, c, FILE *, stream) +#endif HOOK_FILE1(int, putchar, stdout, int, c) HOOK_FILE1(int, puts, stdout,