X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=src%2Fcoloredstderr.c;h=c36c2f732cb409732c0da90a2f87ed10ba448b42;hb=fe3f7d4c635b265c58efd5bc420d32135ec7903e;hp=44726899e4fb7590345d0890410cc6ee57abf3ca;hpb=31a1fdf921bf767154470e94f0f28c299d56cd5a;p=coloredstderr%2Fcoloredstderr.git diff --git a/src/coloredstderr.c b/src/coloredstderr.c index 4472689..c36c2f7 100644 --- a/src/coloredstderr.c +++ b/src/coloredstderr.c @@ -119,14 +119,14 @@ static void close_fd(int fd) { /* "Action" handlers called when a file descriptor is matched. */ -static char *pre_string; +static char const *pre_string; static size_t pre_string_size; -static char *post_string; +static char const *post_string; static size_t post_string_size; /* Load alternative pre/post strings from the environment if available, fall * back to default values. */ -inline static void init_pre_post_string() { +inline static void init_pre_post_string(void) { pre_string = getenv(ENV_NAME_PRE_STRING); if (!pre_string) { pre_string = DEFAULT_PRE_STRING; @@ -140,9 +140,7 @@ inline static void init_pre_post_string() { post_string_size = strlen(post_string); } -static void handle_fd_pre(int fd, int action) { - (void)action; - +static void handle_fd_pre(int fd) { if (!pre_string || !post_string) { init_pre_post_string(); } @@ -150,16 +148,12 @@ static void handle_fd_pre(int fd, int action) { DLSYM_FUNCTION(real_write, "write"); real_write(fd, pre_string, pre_string_size); } -static void handle_fd_post(int fd, int action) { - (void)action; - +static void handle_fd_post(int fd) { /* write() already loaded above in handle_fd_pre(). */ real_write(fd, post_string, post_string_size); } -static void handle_file_pre(FILE *stream, int action) { - (void)action; - +static void handle_file_pre(FILE *stream) { if (!pre_string || !post_string) { init_pre_post_string(); } @@ -167,9 +161,7 @@ static void handle_file_pre(FILE *stream, int action) { DLSYM_FUNCTION(real_fwrite, "fwrite"); real_fwrite(pre_string, pre_string_size, 1, stream); } -static void handle_file_post(FILE *stream, int action) { - (void)action; - +static void handle_file_post(FILE *stream) { /* fwrite() already loaded above in handle_file_pre(). */ real_fwrite(post_string, post_string_size, 1, stream); } @@ -225,8 +217,6 @@ HOOK_FILE2(int, putc_unlocked, stream, int, c, FILE *, stream) HOOK_FILE1(int, putchar_unlocked, stdout, int, c) -HOOK_FILE1(int, puts_unlocked, stdout, - char const *, s) /* perror(3) */ HOOK_VOID1(void, perror, STDERR_FILENO, @@ -476,7 +466,7 @@ int execve(char const *filename, char * const argv[], char * const env[]) { /* Count arguments. */ \ size_t count = 1; /* arg */ \ va_start(ap, arg); \ - while (va_arg(ap, const char *)) { \ + while (va_arg(ap, char const *)) { \ count++; \ } \ va_end(ap); \