summaryrefslogtreecommitdiff
path: root/utils/messages.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 /utils/messages.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 'utils/messages.c')
-rw-r--r--utils/messages.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/utils/messages.c b/utils/messages.c
index c6232979d..78b9a79f0 100644
--- a/utils/messages.c
+++ b/utils/messages.c
@@ -61,8 +61,7 @@ static nserror messages_load_ctx(const char *path, struct hash_table **ctx)
fp = gzopen(path, "r");
if (!fp) {
- LOG(("Unable to open messages file \"%.100s\": %s",
- path, strerror(errno)));
+ LOG("Unable to open messages file \"%.100s\": %s", path, strerror(errno));
return NSERROR_NOT_FOUND;
}
@@ -77,7 +76,7 @@ static nserror messages_load_ctx(const char *path, struct hash_table **ctx)
nctx = *ctx;
}
if (nctx == NULL) {
- LOG(("Unable to create hash table for messages file %s", path));
+ LOG("Unable to create hash table for messages file %s", path);
gzclose(fp);
return NSERROR_NOMEM;
}
@@ -96,8 +95,7 @@ static nserror messages_load_ctx(const char *path, struct hash_table **ctx)
value = colon + 1;
if (hash_add(nctx, s, value) == false) {
- LOG(("Unable to add %s:%s to hash table of %s",
- s, value, path));
+ LOG("Unable to add %s:%s to hash table of %s", s, value, path);
gzclose(fp);
if (*ctx == NULL) {
hash_destroy(nctx);
@@ -151,7 +149,7 @@ nserror messages_load(const char *path)
if (path == NULL) {
err = NSERROR_BAD_PARAMETER;
} else {
- LOG(("Loading Messages from '%s'", path));
+ LOG("Loading Messages from '%s'", path);
err = messages_load_ctx(path, &messages_hash);
}
@@ -176,7 +174,7 @@ char *messages_get_buff(const char *key, ...)
buff = malloc(buff_len + 1);
if (buff == NULL) {
- LOG(("malloc failed"));
+ LOG("malloc failed");
warn_user("NoMemory", 0);
} else {
va_start(ap, key);