summaryrefslogtreecommitdiff
path: root/riscos/gui/url_bar.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 /riscos/gui/url_bar.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 'riscos/gui/url_bar.c')
-rw-r--r--riscos/gui/url_bar.c45
1 files changed, 16 insertions, 29 deletions
diff --git a/riscos/gui/url_bar.c b/riscos/gui/url_bar.c
index 29eddedca..5eccd602e 100644
--- a/riscos/gui/url_bar.c
+++ b/riscos/gui/url_bar.c
@@ -133,7 +133,7 @@ struct url_bar *ro_gui_url_bar_create(struct theme_descriptor *theme)
url_bar = malloc(sizeof(struct url_bar));
if (url_bar == NULL) {
- LOG(("No memory for malloc()"));
+ LOG("No memory for malloc()");
return NULL;
}
@@ -228,8 +228,7 @@ static bool ro_gui_url_bar_icon_resize(struct url_bar *url_bar, bool full)
url_bar->container_icon,
x0, y0, x1, y1);
if (error != NULL) {
- LOG(("xwimp_resize_icon: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xwimp_resize_icon: 0x%x: %s", error->errnum, error->errmess);
warn_user("WimpError", error->errmess);
url_bar->container_icon = -1;
return false;
@@ -249,8 +248,7 @@ static bool ro_gui_url_bar_icon_resize(struct url_bar *url_bar, bool full)
url_bar->suggest_icon,
x0, y0, x1, y1);
if (error != NULL) {
- LOG(("xwimp_resize_icon: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xwimp_resize_icon: 0x%x: %s", error->errnum, error->errmess);
warn_user("WimpError", error->errmess);
url_bar->suggest_icon = -1;
return false;
@@ -271,8 +269,7 @@ static bool ro_gui_url_bar_icon_resize(struct url_bar *url_bar, bool full)
url_bar->text_icon,
x0, y0, x1, y1);
if (error != NULL) {
- LOG(("xwimp_resize_icon: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xwimp_resize_icon: 0x%x: %s", error->errnum, error->errmess);
warn_user("WimpError", error->errmess);
url_bar->text_icon = -1;
return false;
@@ -353,8 +350,7 @@ static bool ro_gui_url_bar_icon_update(struct url_bar *url_bar)
wimp_ICON_BUTTON_TYPE_SHIFT);
error = xwimp_create_icon(&icon, &url_bar->container_icon);
if (error != NULL) {
- LOG(("xwimp_create_icon: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xwimp_create_icon: 0x%x: %s", error->errnum, error->errmess);
warn_user("WimpError", error->errmess);
url_bar->container_icon = -1;
return false;
@@ -365,8 +361,7 @@ static bool ro_gui_url_bar_icon_update(struct url_bar *url_bar)
error = xwimp_delete_icon(url_bar->window,
url_bar->container_icon);
if (error != NULL) {
- LOG(("xwimp_delete_icon: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xwimp_delete_icon: 0x%x: %s", error->errnum, error->errmess);
warn_user("WimpError", error->errmess);
return false;
}
@@ -392,8 +387,7 @@ static bool ro_gui_url_bar_icon_update(struct url_bar *url_bar)
wimp_ICON_BUTTON_TYPE_SHIFT);
error = xwimp_create_icon(&icon, &url_bar->text_icon);
if (error) {
- LOG(("xwimp_create_icon: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xwimp_create_icon: 0x%x: %s", error->errnum, error->errmess);
warn_user("WimpError", error->errmess);
url_bar->text_icon = -1;
return false;
@@ -404,8 +398,7 @@ static bool ro_gui_url_bar_icon_update(struct url_bar *url_bar)
error = xwimp_delete_icon(url_bar->window,
url_bar->text_icon);
if (error != NULL) {
- LOG(("xwimp_delete_icon: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xwimp_delete_icon: 0x%x: %s", error->errnum, error->errmess);
warn_user("WimpError", error->errmess);
return false;
}
@@ -425,8 +418,7 @@ static bool ro_gui_url_bar_icon_update(struct url_bar *url_bar)
wimp_ICON_BUTTON_TYPE_SHIFT);
error = xwimp_create_icon(&icon, &url_bar->suggest_icon);
if (error) {
- LOG(("xwimp_create_icon: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xwimp_create_icon: 0x%x: %s", error->errnum, error->errmess);
warn_user("WimpError", error->errmess);
return false;
}
@@ -446,8 +438,7 @@ static bool ro_gui_url_bar_icon_update(struct url_bar *url_bar)
error = xwimp_delete_icon(url_bar->window,
url_bar->suggest_icon);
if (error != NULL) {
- LOG(("xwimp_delete_icon: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xwimp_delete_icon: 0x%x: %s", error->errnum, error->errmess);
warn_user("WimpError", error->errmess);
return false;
}
@@ -931,8 +922,7 @@ bool ro_gui_url_bar_take_caret(struct url_bar *url_bar)
error = xwimp_set_caret_position(url_bar->window, url_bar->text_icon,
-1, -1, -1, 0);
if (error) {
- LOG(("xwimp_set_caret_position: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xwimp_set_caret_position: 0x%x: %s", error->errnum, error->errmess);
warn_user("WimpError", error->errmess);
return false;
@@ -969,7 +959,7 @@ void ro_gui_url_bar_set_url(struct url_bar *url_bar, const char *url,
if (err != NSERROR_OK) {
/* A bad encoding should never happen, so assert this */
assert(err != NSERROR_BAD_ENCODING);
- LOG(("utf8_to_enc failed"));
+ LOG("utf8_to_enc failed");
/* Paranoia */
local_text = NULL;
}
@@ -986,7 +976,7 @@ void ro_gui_url_bar_set_url(struct url_bar *url_bar, const char *url,
strncpy(url_bar->text_buffer, "", url_bar->text_size - 1);
url_bar->text_buffer[url_bar->text_size - 1] = '\0';
warn_user("LongURL", NULL);
- LOG(("Long URL (%d chars): %s", strlen(url), url));
+ LOG("Long URL (%d chars): %s", strlen(url), url);
} else {
strncpy(url_bar->text_buffer, local_url,
url_bar->text_size - 1);
@@ -1014,8 +1004,7 @@ void ro_gui_url_bar_set_url(struct url_bar *url_bar, const char *url,
error = xwimp_get_caret_position(&caret);
if (error) {
- LOG(("xwimp_get_caret_position: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xwimp_get_caret_position: 0x%x: %s", error->errnum, error->errmess);
warn_user("WimpError", error->errmess);
return;
}
@@ -1028,8 +1017,7 @@ void ro_gui_url_bar_set_url(struct url_bar *url_bar, const char *url,
error = xwimp_set_caret_position(url_bar->window,
url_bar->text_icon, 0, 0, -1, strlen(set_url));
if (error) {
- LOG(("xwimp_set_caret_position: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xwimp_set_caret_position: 0x%x: %s", error->errnum, error->errmess);
warn_user("WimpError", error->errmess);
}
}
@@ -1106,8 +1094,7 @@ bool ro_gui_url_bar_get_url_extent(struct url_bar *url_bar, os_box *extent)
state.i = url_bar->container_icon;
error = xwimp_get_icon_state(&state);
if (error) {
- LOG(("xwimp_get_icon_state: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess);
warn_user("WimpError", error->errmess);
return false;
}