From c105738fa36bb2400adc47399c5b878d252d1c86 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Thu, 28 May 2015 16:08:46 +0100 Subject: Change LOG() macro to be varadic This changes the LOG macro to be varadic removing the need for all callsites to have double bracketing and allows for future improvement on how we use the logging macros. The callsites were changed with coccinelle and the changes checked by hand. Compile tested for several frontends but not all. A formatting annotation has also been added which allows the compiler to check the parameters and types passed to the logging. --- monkey/poll.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'monkey/poll.c') diff --git a/monkey/poll.c b/monkey/poll.c index 6e96919a1..3ec31af86 100644 --- a/monkey/poll.c +++ b/monkey/poll.c @@ -29,7 +29,7 @@ #ifdef DEBUG_POLL_LOOP #include "utils/log.h" #else -#define LOG(X) +#define LOG(fmt, args...) ((void) 0) #endif @@ -103,7 +103,7 @@ void monkey_poll(void) fd->events = G_IO_IN | G_IO_HUP | G_IO_ERR; g_main_context_add_poll(0, fd, 0); fd_list[fd_count++] = fd; - LOG(("Want to read %d", i)); + LOG("Want to read %d", i); } if (FD_ISSET(i, &write_fd_set)) { GPollFD *fd = malloc(sizeof *fd); @@ -111,7 +111,7 @@ void monkey_poll(void) fd->events = G_IO_OUT | G_IO_ERR; g_main_context_add_poll(0, fd, 0); fd_list[fd_count++] = fd; - LOG(("Want to write %d", i)); + LOG("Want to write %d", i); } if (FD_ISSET(i, &exc_fd_set)) { GPollFD *fd = malloc(sizeof *fd); @@ -119,13 +119,13 @@ void monkey_poll(void) fd->events = G_IO_ERR; g_main_context_add_poll(0, fd, 0); fd_list[fd_count++] = fd; - LOG(("Want to check %d", i)); + LOG("Want to check %d", i); } } schedule_run(); - LOG(("Iterate %sblocking", block?"":"non-")); + LOG("Iterate %sblocking", block ? "" : "non-"); if (block) { fprintf(stdout, "GENERIC POLL BLOCKING\n"); } -- cgit v1.2.3