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. --- css/css.c | 12 +++++------- css/select.c | 14 +++++++------- 2 files changed, 12 insertions(+), 14 deletions(-) (limited to 'css') diff --git a/css/css.c b/css/css.c index 641d988ad..acbc14a14 100644 --- a/css/css.c +++ b/css/css.c @@ -326,9 +326,9 @@ static css_error nscss_convert_css_data(struct content_css_data *c) const char *url; if (css_stylesheet_get_url(c->sheet, &url) == CSS_OK) { - LOG(("Failed converting %p %s (%d)", c, url, error)); + LOG("Failed converting %p %s (%d)", c, url, error); } else { - LOG(("Failed converting %p (%d)", c, error)); + LOG("Failed converting %p (%d)", c, error); } } @@ -616,9 +616,7 @@ css_error nscss_handle_import(void *pw, css_stylesheet *parent, nsurl_unref(ns_ref); #ifdef NSCSS_IMPORT_TRACE - LOG(("Import %d '%s' -> (handle: %p ctx: %p)", - c->import_count, lwc_string_data(url), - c->imports[c->import_count].c, ctx)); + LOG("Import %d '%s' -> (handle: %p ctx: %p)", c->import_count, lwc_string_data(url), c->imports[c->import_count].c, ctx); #endif c->import_count++; @@ -641,7 +639,7 @@ nserror nscss_import(hlcache_handle *handle, css_error error = CSS_OK; #ifdef NSCSS_IMPORT_TRACE - LOG(("Event %d for %p (%p)", event->type, handle, ctx)); + LOG("Event %d for %p (%p)", event->type, handle, ctx); #endif assert(ctx->css->imports[ctx->index].c == handle); @@ -682,7 +680,7 @@ css_error nscss_import_complete(nscss_import_ctx *ctx) error = nscss_register_imports(ctx->css); #ifdef NSCSS_IMPORT_TRACE - LOG(("Destroying import context %p for %d", ctx, ctx->index)); + LOG("Destroying import context %p for %d", ctx, ctx->index); #endif /* No longer need import context */ diff --git a/css/select.c b/css/select.c index b94bcac4f..f4570f7c2 100644 --- a/css/select.c +++ b/css/select.c @@ -190,20 +190,20 @@ css_stylesheet *nscss_create_inline_style(const uint8_t *data, size_t len, error = css_stylesheet_create(¶ms, &sheet); if (error != CSS_OK) { - LOG(("Failed creating sheet: %d", error)); + LOG("Failed creating sheet: %d", error); return NULL; } error = css_stylesheet_append_data(sheet, data, len); if (error != CSS_OK && error != CSS_NEEDDATA) { - LOG(("failed appending data: %d", error)); + LOG("failed appending data: %d", error); css_stylesheet_destroy(sheet); return NULL; } error = css_stylesheet_data_done(sheet); if (error != CSS_OK) { - LOG(("failed completing parse: %d", error)); + LOG("failed completing parse: %d", error); css_stylesheet_destroy(sheet); return NULL; } @@ -229,7 +229,7 @@ static void nscss_dom_user_data_handler(dom_node_operation operation, CSS_NODE_CLONED, NULL, src, dst, data); if (error != CSS_OK) - LOG(("Failed to clone libcss_node_data.")); + LOG("Failed to clone libcss_node_data."); break; case DOM_NODE_RENAMED: @@ -237,7 +237,7 @@ static void nscss_dom_user_data_handler(dom_node_operation operation, CSS_NODE_MODIFIED, NULL, src, NULL, data); if (error != CSS_OK) - LOG(("Failed to update libcss_node_data.")); + LOG("Failed to update libcss_node_data."); break; case DOM_NODE_IMPORTED: @@ -247,11 +247,11 @@ static void nscss_dom_user_data_handler(dom_node_operation operation, CSS_NODE_DELETED, NULL, src, NULL, data); if (error != CSS_OK) - LOG(("Failed to delete libcss_node_data.")); + LOG("Failed to delete libcss_node_data."); break; default: - LOG(("User data operation not handled.")); + LOG("User data operation not handled."); assert(0); } } -- cgit v1.2.3