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 /atari/rootwin.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 'atari/rootwin.c')
-rw-r--r-- | atari/rootwin.c | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/atari/rootwin.c b/atari/rootwin.c index 7b4cd0361..c9f507167 100644 --- a/atari/rootwin.c +++ b/atari/rootwin.c @@ -106,7 +106,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) switch (msg[0]) { case WM_REDRAW: - LOG(("WM_REDRAW")); + LOG("WM_REDRAW"); on_redraw(data->rootwin, msg); break; @@ -114,7 +114,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) case WM_SIZED: case WM_MOVED: case WM_FULLED: - LOG(("WM_SIZED")); + LOG("WM_SIZED"); on_resized(data->rootwin); break; @@ -133,7 +133,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) case WM_TOPPED: case WM_NEWTOP: case WM_UNICONIFY: - LOG(("WM_TOPPED")); + LOG("WM_TOPPED"); gui_set_input_gui_window(data->rootwin->active_gui_window); //window_restore_active_gui_window(data->rootwin); // TODO: use something like "restore_active_gui_window_state()" @@ -144,8 +144,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) // TODO: this needs to iterate through all gui windows and // check if the rootwin is this window... if (data->rootwin->active_gui_window != NULL) { - LOG(("WM_CLOSED initiated destroy for bw %p", - data->rootwin->active_gui_window->browser->bw)); + LOG("WM_CLOSED initiated destroy for bw %p", data->rootwin->active_gui_window->browser->bw); browser_window_destroy( data->rootwin->active_gui_window->browser->bw); } @@ -168,14 +167,13 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) // handle key uint16_t nkc = gem_to_norm( (short)ev_out->emo_kmeta, (short)ev_out->emo_kreturn); - LOG(("rootwin MU_KEYBD input, nkc: %x\n", nkc)); + LOG("rootwin MU_KEYBD input, nkc: %x\n", nkc); retval = on_window_key_input(data->rootwin, nkc); // printf("on_window_key_input: %d\n", retval); } if ((ev_out->emo_events & MU_BUTTON) != 0) { - LOG(("rootwin MU_BUTTON input, x: %d, y: %d\n", ev_out->emo_mouse.p_x, - ev_out->emo_mouse.p_x)); + LOG("rootwin MU_BUTTON input, x: %d, y: %d\n", ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_x); window_get_grect(data->rootwin, BROWSER_AREA_CONTENT, &area); if (POINT_WITHIN(ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y, @@ -315,13 +313,13 @@ void window_unref_gui_window(ROOTWIN *rootwin, struct gui_window *gw) struct gui_window *w; input_window = NULL; - LOG(("window: %p, gui_window: %p", rootwin, gw)); + LOG("window: %p, gui_window: %p", rootwin, gw); w = window_list; // find the next active tab: while( w != NULL ) { if(w->root == rootwin && w != gw) { - LOG(("activating next tab %p", w)); + LOG("activating next tab %p", w); gui_set_input_gui_window(w); break; } @@ -341,7 +339,7 @@ int window_destroy(ROOTWIN *rootwin) assert(rootwin != NULL); - LOG(("%p", rootwin)); + LOG("%p", rootwin); if (gemtk_wm_get_user_data(rootwin->win) != NULL) { free(gemtk_wm_get_user_data(rootwin->win)); @@ -407,7 +405,7 @@ void window_restore_active_gui_window(ROOTWIN *rootwin) GRECT tb_area; struct gui_window *gw; - LOG(("")); + LOG(""); assert(rootwin->active_gui_window); @@ -502,7 +500,7 @@ void window_set_focus(struct s_gui_win_root *rootwin, assert(rootwin != NULL); if (rootwin->focus.type != type || rootwin->focus.element != element) { - LOG(("Set focus: %p (%d)\n", element, type)); + LOG("Set focus: %p (%d)\n", element, type); rootwin->focus.type = type; rootwin->focus.element = element; switch( type ) { @@ -566,11 +564,11 @@ void window_set_active_gui_window(ROOTWIN *rootwin, struct gui_window *gw) { struct gui_window *old_gw = rootwin->active_gui_window; - LOG(("")); + LOG(""); if (rootwin->active_gui_window != NULL) { if(rootwin->active_gui_window == gw) { - LOG(("nothing to do...")); + LOG("nothing to do..."); return; } } @@ -579,7 +577,7 @@ void window_set_active_gui_window(ROOTWIN *rootwin, struct gui_window *gw) rootwin->active_gui_window = gw; if (old_gw != NULL) { - LOG(("restoring window...")); + LOG("restoring window..."); window_restore_active_gui_window(rootwin); } } @@ -654,7 +652,7 @@ void window_open_search(ROOTWIN *rootwin, bool reformat) GRECT area; OBJECT *obj; - LOG(("")); + LOG(""); gw = rootwin->active_gui_window; bw = gw->browser->bw; @@ -1471,10 +1469,7 @@ static void on_file_dropped(ROOTWIN *rootwin, short msg[8]) buff[size] = 0; - LOG(("file: %s, ext: %s, size: %d dropped at: %d,%d\n", - (char*)buff, (char*)&ext, - size, mx, my - )); + LOG("file: %s, ext: %s, size: %d dropped at: %d,%d\n", (char *)buff, (char *)&ext, size, mx, my); gui_window_get_scroll(gw, &sx, &sy); @@ -1496,7 +1491,7 @@ static void on_file_dropped(ROOTWIN *rootwin, short msg[8]) if (ret != NSERROR_OK) { free(buff); /* A bad encoding should never happen */ - LOG(("utf8_from_local_encoding failed")); + LOG("utf8_from_local_encoding failed"); assert(ret != NSERROR_BAD_ENCODING); /* no memory */ goto error; |