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. --- windows/drawable.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'windows/drawable.c') diff --git a/windows/drawable.c b/windows/drawable.c index f53e5d4d2..317143a46 100644 --- a/windows/drawable.c +++ b/windows/drawable.c @@ -76,7 +76,7 @@ nsws_drawable_vscroll(struct gui_window *gw, HWND hwnd, WPARAM wparam) SCROLLINFO si; int mem; - LOG(("VSCROLL %d", gw->requestscrolly)); + LOG("VSCROLL %d", gw->requestscrolly); if (gw->requestscrolly != 0) return 0; @@ -148,7 +148,7 @@ nsws_drawable_hscroll(struct gui_window *gw, HWND hwnd, WPARAM wparam) SCROLLINFO si; int mem; - LOG(("HSCROLL %d", gw->requestscrollx)); + LOG("HSCROLL %d", gw->requestscrollx); if (gw->requestscrollx != 0) return 0; @@ -357,7 +357,7 @@ nsws_drawable_mouseup(struct gui_window *gw, (gw->bw == NULL)) return 0; - LOG(("state 0x%x, press 0x%x", gw->mouse->state, press)); + LOG("state 0x%x, press 0x%x", gw->mouse->state, press); if ((gw->mouse->state & press) != 0) { gw->mouse->state &= ~press; gw->mouse->state |= click; @@ -371,10 +371,7 @@ nsws_drawable_mouseup(struct gui_window *gw, gw->mouse->state &= ~BROWSER_MOUSE_MOD_3; if ((gw->mouse->state & click) != 0) { - LOG(("mouse click bw %p, state 0x%x, x %f, y %f",gw->bw, - gw->mouse->state, - (x + gw->scrollx) / gw->scale, - (y + gw->scrolly) / gw->scale)); + LOG("mouse click bw %p, state 0x%x, x %f, y %f", gw->bw, gw->mouse->state, (x + gw->scrollx) / gw->scale, (y + gw->scrolly) / gw->scale); browser_window_mouse_click(gw->bw, gw->mouse->state, @@ -418,10 +415,7 @@ nsws_drawable_mousedown(struct gui_window *gw, gw->mouse->pressed_x = (x + gw->scrollx) / gw->scale; gw->mouse->pressed_y = (y + gw->scrolly) / gw->scale; - LOG(("mouse click bw %p, state %x, x %f, y %f", gw->bw, - gw->mouse->state, - (x + gw->scrollx) / gw->scale, - (y + gw->scrolly) / gw->scale)); + LOG("mouse click bw %p, state %x, x %f, y %f", gw->bw, gw->mouse->state, (x + gw->scrollx) / gw->scale, (y + gw->scrolly) / gw->scale); browser_window_mouse_click(gw->bw, gw->mouse->state, (x + gw->scrollx) / gw->scale, @@ -453,7 +447,7 @@ nsws_drawable_mousemove(struct gui_window *gw, int x, int y) (abs(x - gw->mouse->pressed_x) >= 5) && (abs(y - gw->mouse->pressed_y) >= 5)) { - LOG(("Drag start state 0x%x", gw->mouse->state)); + LOG("Drag start state 0x%x", gw->mouse->state); if ((gw->mouse->state & BROWSER_MOUSE_PRESS_1) != 0) { browser_window_mouse_click(gw->bw, BROWSER_MOUSE_DRAG_1, @@ -501,7 +495,7 @@ nsws_window_drawable_event_callback(HWND hwnd, gw = nsws_get_gui_window(hwnd); if (gw == NULL) { - LOG(("Unable to find gui window structure for hwnd %p", hwnd)); + LOG("Unable to find gui window structure for hwnd %p", hwnd); return DefWindowProc(hwnd, msg, wparam, lparam); } @@ -590,7 +584,7 @@ nsws_window_create_drawable(HINSTANCE hinstance, if (hwnd == NULL) { win_perror("WindowCreateDrawable"); - LOG(("Window creation failed")); + LOG("Window creation failed"); return NULL; } -- cgit v1.2.3