summaryrefslogtreecommitdiff
path: root/desktop/browser.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2015-05-28 16:08:46 +0100
committerVincent Sanders <vince@kyllikki.org>2015-05-28 16:08:46 +0100
commitc105738fa36bb2400adc47399c5b878d252d1c86 (patch)
tree138eeb449e1bf51ee1726b5f820740aada0ccd0b /desktop/browser.c
parent20f2c86a511f7913cf858e7bd3668b0b59663ba0 (diff)
downloadnetsurf-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 'desktop/browser.c')
-rw-r--r--desktop/browser.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/desktop/browser.c b/desktop/browser.c
index abda8853a..2d7257bd4 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -129,7 +129,7 @@ bool browser_window_redraw(struct browser_window *bw, int x, int y,
struct rect content_clip;
if (bw == NULL) {
- LOG(("NULL browser window"));
+ LOG("NULL browser window");
return false;
}
@@ -286,7 +286,7 @@ bool browser_window_redraw(struct browser_window *bw, int x, int y,
bool browser_window_redraw_ready(struct browser_window *bw)
{
if (bw == NULL) {
- LOG(("NULL browser window"));
+ LOG("NULL browser window");
return false;
} else if (bw->current_content != NULL) {
/* Can't render locked contents */
@@ -359,7 +359,7 @@ void browser_window_set_position(struct browser_window *bw, int x, int y)
bw->x = x;
bw->y = y;
} else {
- LOG(("Asked to set position of front end window."));
+ LOG("Asked to set position of front end window.");
assert(0);
}
}
@@ -756,7 +756,7 @@ nserror browser_window_debug(struct browser_window *bw, enum content_debug op)
static bool slow_script(void *ctx)
{
static int count = 0;
- LOG(("Continuing execution %d", count));
+ LOG("Continuing execution %d", count);
count++;
if (count > 1) {
count = 0;
@@ -924,11 +924,11 @@ browser_window_download(struct browser_window *bw,
/* no internal handler for this type, call out to frontend */
error = guit->browser->launch_url(url);
} else if (error != NSERROR_OK) {
- LOG(("Failed to fetch download: %d", error));
+ LOG("Failed to fetch download: %d", error);
} else {
error = download_context_create(l, root->window);
if (error != NSERROR_OK) {
- LOG(("Failed creating download context: %d", error));
+ LOG("Failed creating download context: %d", error);
llcache_handle_abort(l);
llcache_handle_release(l);
}
@@ -1048,7 +1048,7 @@ static nserror browser_window_favicon_callback(hlcache_handle *c,
error = nsurl_create("resource:favicon.ico", &nsurl);
if (error != NSERROR_OK) {
- LOG(("Unable to create default location url"));
+ LOG("Unable to create default location url");
} else {
hlcache_handle_retrieve(nsurl,
@@ -1129,7 +1129,7 @@ static void browser_window_update_favicon(hlcache_handle *c,
error = nsurl_create("resource:favicon.ico", &nsurl);
}
if (error != NSERROR_OK) {
- LOG(("Unable to create default location url"));
+ LOG("Unable to create default location url");
return;
}
} else {
@@ -1137,12 +1137,9 @@ static void browser_window_update_favicon(hlcache_handle *c,
}
if (link == NULL) {
- LOG(("fetching general favicon from '%s'",
- nsurl_access(nsurl)));
+ LOG("fetching general favicon from '%s'", nsurl_access(nsurl));
} else {
- LOG(("fetching favicon rel:%s '%s'",
- lwc_string_data(link->rel),
- nsurl_access(nsurl)));
+ LOG("fetching favicon rel:%s '%s'", lwc_string_data(link->rel), nsurl_access(nsurl));
}
hlcache_handle_retrieve(nsurl, HLCACHE_RETRIEVE_SNIFF_TYPE,
@@ -1710,7 +1707,7 @@ static void browser_window_destroy_internal(struct browser_window *bw)
{
assert(bw);
- LOG(("Destroying window"));
+ LOG("Destroying window");
if (bw->children != NULL || bw->iframes != NULL) {
browser_window_destroy_children(bw);
@@ -1721,7 +1718,7 @@ static void browser_window_destroy_internal(struct browser_window *bw)
/* The ugly cast here is so the reformat function can be
* passed a gui window pointer in its API rather than void*
*/
- LOG(("Clearing schedule %p(%p)", guit->window->reformat, bw->window));
+ LOG("Clearing schedule %p(%p)", guit->window->reformat, bw->window);
guit->browser->schedule(-1, (void(*)(void*))guit->window->reformat, bw->window);
/* If this brower window is not the root window, and has focus, unset
@@ -1799,8 +1796,7 @@ static void browser_window_destroy_internal(struct browser_window *bw)
free(bw->name);
free(bw->status_text);
bw->status_text = NULL;
- LOG(("Status text cache match:miss %d:%d",
- bw->status_match, bw->status_miss));
+ LOG("Status text cache match:miss %d:%d", bw->status_match, bw->status_miss);
}
/**
@@ -1892,14 +1888,14 @@ nserror browser_window_navigate(struct browser_window *bw,
assert(bw);
assert(url);
- LOG(("bw %p, url %s", bw, nsurl_access(url)));
+ LOG("bw %p, url %s", bw, nsurl_access(url));
/* don't allow massively nested framesets */
for (cur = bw; cur->parent; cur = cur->parent) {
depth++;
}
if (depth > FRAME_DEPTH) {
- LOG(("frame depth too high."));
+ LOG("frame depth too high.");
return NSERROR_FRAME_DEPTH;
}
@@ -1991,7 +1987,7 @@ nserror browser_window_navigate(struct browser_window *bw,
browser_window_remove_caret(bw, false);
browser_window_destroy_children(bw);
- LOG(("Loading '%s'", nsurl_access(url)));
+ LOG("Loading '%s'", nsurl_access(url));
browser_window_set_status(bw, messages_get("Loading"));
bw->history_add = (flags & BW_NAVIGATE_HISTORY);
@@ -2207,7 +2203,7 @@ void browser_window_set_dimensions(struct browser_window *bw,
bw->width = width;
bw->height = height;
} else {
- LOG(("Asked to set dimensions of front end window."));
+ LOG("Asked to set dimensions of front end window.");
assert(0);
}
}
@@ -2484,7 +2480,7 @@ nserror browser_window_schedule_reformat(struct browser_window *bw)
/* The ugly cast here is so the reformat function can be
* passed a gui window pointer in its API rather than void*
*/
- LOG(("Scheduleing %p(%p)", guit->window->reformat, bw->window));
+ LOG("Scheduleing %p(%p)", guit->window->reformat, bw->window);
guit->browser->schedule(0, (void(*)(void*))guit->window->reformat, bw->window);
return NSERROR_OK;
}