X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=src%2Fhookmacros.h;h=b8b70ec03bf035fc26c927de13e5caaaa7331daa;hb=7adfbfd2cf1d46144c41a75aa501938607a316b5;hp=0eb47cd67abd45451dc85b02e0573a7e04119ced;hpb=048bd6f9e7f316aafede310ba273776d0086b8ed;p=coloredstderr%2Fcoloredstderr.git diff --git a/src/hookmacros.h b/src/hookmacros.h index 0eb47cd..b8b70ec 100644 --- a/src/hookmacros.h +++ b/src/hookmacros.h @@ -38,7 +38,7 @@ * if (force_write_to_non_tty) { * handle = 1; * } else { - * handle = isatty(); + * handle = isatty_noinline(); * } * } else { * handle = 0; @@ -72,7 +72,7 @@ if (unlikely(force_write_to_non_tty)) { \ handle = 1; \ } else { \ - handle = isatty(fd); \ + handle = isatty_noinline(fd); \ } \ } else { \ handle = 0; \ @@ -87,7 +87,7 @@ if (unlikely(force_write_to_non_tty)) { \ handle = 1; \ } else { \ - handle = isatty(fileno(file)); \ + handle = isatty_noinline(fileno(file)); \ } \ } else { \ handle = 0; \ @@ -117,6 +117,13 @@ _HOOK_POST_FD_(fd) \ } +#define HOOK_FD2(type, name, fd, type1, arg1, type2, arg2) \ + static type (*real_ ## name)(type1, type2); \ + type name(type1 arg1, type2 arg2) { \ + _HOOK_PRE_FD(type, name, fd) \ + result = real_ ## name(arg1, arg2); \ + _HOOK_POST_FD(fd) \ + } #define HOOK_FD3(type, name, fd, type1, arg1, type2, arg2, type3, arg3) \ static type (*real_ ## name)(type1, type2, type3); \ type name(type1 arg1, type2 arg2, type3 arg3) { \ @@ -176,8 +183,7 @@ } #define HOOK_VAR_FILE3(type, name, file, func, type1, arg1, type2, arg2, type3, arg3) \ static type (*real_ ## func)(type1, type2, type3, va_list); \ - type name(type1 arg1, type2 arg2, type3 arg3, ...) \ - { \ + type name(type1 arg1, type2 arg2, type3 arg3, ...) { \ va_list ap; \ _HOOK_PRE_FILE(type, func, file) \ va_start(ap, arg3); \