diff options
author | Vincent Sanders <vince@kyllikki.org> | 2015-05-28 16:08:46 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2015-05-28 16:08:46 +0100 |
commit | c105738fa36bb2400adc47399c5b878d252d1c86 (patch) | |
tree | 138eeb449e1bf51ee1726b5f820740aada0ccd0b /gtk/schedule.c | |
parent | 20f2c86a511f7913cf858e7bd3668b0b59663ba0 (diff) | |
download | netsurf-c105738fa36bb2400adc47399c5b878d252d1c86.tar.gz netsurf-c105738fa36bb2400adc47399c5b878d252d1c86.tar.bz2 |
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.
Diffstat (limited to 'gtk/schedule.c')
-rw-r--r-- | gtk/schedule.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/gtk/schedule.c b/gtk/schedule.c index e28675a0b..cf0333388 100644 --- a/gtk/schedule.c +++ b/gtk/schedule.c @@ -27,7 +27,7 @@ #ifdef DEBUG_GTK_SCHEDULE #include "utils/log.h" #else -#define LOG(X) +#define LOG(format, args...) ((void) 0) #endif /** Killable callback closure embodiment. */ @@ -50,7 +50,7 @@ nsgtk_schedule_generic_callback(gpointer data) _nsgtk_callback_t *cb = (_nsgtk_callback_t *)(data); if (cb->callback_killed) { /* This callback instance has been killed. */ - LOG(("CB at %p already dead.", cb)); + LOG("CB at %p already dead.", cb); } queued_callbacks = g_list_remove(queued_callbacks, cb); pending_callbacks = g_list_append(pending_callbacks, cb); @@ -64,8 +64,7 @@ nsgtk_schedule_kill_callback(void *_target, void *_match) _nsgtk_callback_t *match = (_nsgtk_callback_t *)_match; if ((target->callback == match->callback) && (target->context == match->context)) { - LOG(("Found match for %p(%p), killing.", - target->callback, target->context)); + LOG("Found match for %p(%p), killing.", target->callback, target->context); target->callback = NULL; target->context = NULL; target->callback_killed = true; @@ -123,7 +122,7 @@ schedule_run(void) /* Clear the pending list. */ pending_callbacks = NULL; - LOG(("Captured a run of %d callbacks to fire.", g_list_length(this_run))); + LOG("Captured a run of %d callbacks to fire.", g_list_length(this_run)); /* Run all the callbacks which made it this far. */ while (this_run != NULL) { |