summaryrefslogtreecommitdiff
path: root/content/handlers
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2017-09-06 18:28:12 +0100
committerVincent Sanders <vince@kyllikki.org>2017-09-06 18:45:27 +0100
commit75018632a9b953aafeae6f4e8aea607fd1d89dca (patch)
treed661d2fded2ad4b80c4cf019dee2954c052ab090 /content/handlers
parent8d9b2efc11529da8cb5870b39ff15249c648b10a (diff)
downloadnetsurf-75018632a9b953aafeae6f4e8aea607fd1d89dca.tar.gz
netsurf-75018632a9b953aafeae6f4e8aea607fd1d89dca.tar.bz2
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done @@ expression E; @@ -LOG(E); +NSLOG(netsurf, INFO, E); @@ expression E, E1; @@ -LOG(E, E1); +NSLOG(netsurf, INFO, E, E1); @@ expression E, E1, E2; @@ -LOG(E, E1, E2); +NSLOG(netsurf, INFO, E, E1, E2); @@ expression E, E1, E2, E3; @@ -LOG(E, E1, E2, E3); +NSLOG(netsurf, INFO, E, E1, E2, E3); @@ expression E, E1, E2, E3, E4; @@ -LOG(E, E1, E2, E3, E4); +NSLOG(netsurf, INFO, E, E1, E2, E3, E4); @@ expression E, E1, E2, E3, E4, E5; @@ -LOG(E, E1, E2, E3, E4, E5); +NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5); @@ expression E, E1, E2, E3, E4, E5, E6; @@ -LOG(E, E1, E2, E3, E4, E5, E6); +NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6); @@ expression E, E1, E2, E3, E4, E5, E6, E7; @@ -LOG(E, E1, E2, E3, E4, E5, E6, E7); +NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
Diffstat (limited to 'content/handlers')
-rw-r--r--content/handlers/css/css.c15
-rw-r--r--content/handlers/css/hints.c2
-rw-r--r--content/handlers/css/select.c17
-rw-r--r--content/handlers/image/ico.c8
-rw-r--r--content/handlers/image/image_cache.c110
-rw-r--r--content/handlers/image/jpeg.c4
-rw-r--r--content/handlers/image/nssprite.c4
-rw-r--r--content/handlers/image/png.c15
-rw-r--r--content/handlers/image/rsvg.c17
-rw-r--r--content/handlers/javascript/duktape/dukky.c131
10 files changed, 187 insertions, 136 deletions
diff --git a/content/handlers/css/css.c b/content/handlers/css/css.c
index 0a8ffdd5a..93efd6a1b 100644
--- a/content/handlers/css/css.c
+++ b/content/handlers/css/css.c
@@ -321,9 +321,11 @@ 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);
+ NSLOG(netsurf, INFO, "Failed converting %p %s (%d)",
+ c, url, error);
} else {
- LOG("Failed converting %p (%d)", c, error);
+ NSLOG(netsurf, INFO, "Failed converting %p (%d)", c,
+ error);
}
}
@@ -598,7 +600,9 @@ 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);
+ NSLOG(netsurf, INFO, "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++;
@@ -621,7 +625,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);
+ NSLOG(netsurf, INFO, "Event %d for %p (%p)", event->type, handle, ctx);
#endif
assert(ctx->css->imports[ctx->index].c == handle);
@@ -663,7 +667,8 @@ 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);
+ NSLOG(netsurf, INFO, "Destroying import context %p for %d", ctx,
+ ctx->index);
#endif
/* No longer need import context */
diff --git a/content/handlers/css/hints.c b/content/handlers/css/hints.c
index 9dfcf402b..08fe438c1 100644
--- a/content/handlers/css/hints.c
+++ b/content/handlers/css/hints.c
@@ -1615,7 +1615,7 @@ css_error node_presentational_hint(void *pw, void *node,
}
#ifdef LOG_STATS
- LOG("Properties with hints: %i", hint_ctx.len);
+ NSLOG(netsurf, INFO, "Properties with hints: %i", hint_ctx.len);
#endif
css_hint_get_hints(hints, nhints);
diff --git a/content/handlers/css/select.c b/content/handlers/css/select.c
index daa3b4087..328d6a711 100644
--- a/content/handlers/css/select.c
+++ b/content/handlers/css/select.c
@@ -175,20 +175,20 @@ css_stylesheet *nscss_create_inline_style(const uint8_t *data, size_t len,
error = css_stylesheet_create(&params, &sheet);
if (error != CSS_OK) {
- LOG("Failed creating sheet: %d", error);
+ NSLOG(netsurf, INFO, "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);
+ NSLOG(netsurf, INFO, "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);
+ NSLOG(netsurf, INFO, "failed completing parse: %d", error);
css_stylesheet_destroy(sheet);
return NULL;
}
@@ -214,7 +214,8 @@ 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.");
+ NSLOG(netsurf, INFO,
+ "Failed to clone libcss_node_data.");
break;
case DOM_NODE_RENAMED:
@@ -222,7 +223,8 @@ 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.");
+ NSLOG(netsurf, INFO,
+ "Failed to update libcss_node_data.");
break;
case DOM_NODE_IMPORTED:
@@ -232,11 +234,12 @@ 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.");
+ NSLOG(netsurf, INFO,
+ "Failed to delete libcss_node_data.");
break;
default:
- LOG("User data operation not handled.");
+ NSLOG(netsurf, INFO, "User data operation not handled.");
assert(0);
}
}
diff --git a/content/handlers/image/ico.c b/content/handlers/image/ico.c
index d1865a3b4..85aab9f64 100644
--- a/content/handlers/image/ico.c
+++ b/content/handlers/image/ico.c
@@ -160,7 +160,7 @@ static bool nsico_convert(struct content *c)
bmp = ico_find(ico->ico, 255, 255);
if (bmp == NULL) {
/* return error */
- LOG("Failed to select icon");
+ NSLOG(netsurf, INFO, "Failed to select icon");
return false;
}
@@ -183,7 +183,7 @@ static bool nsico_redraw(struct content *c, struct content_redraw_data *data,
bmp = ico_find(ico->ico, data->width, data->height);
if (bmp == NULL) {
/* return error */
- LOG("Failed to select icon");
+ NSLOG(netsurf, INFO, "Failed to select icon");
return false;
}
@@ -192,7 +192,7 @@ static bool nsico_redraw(struct content *c, struct content_redraw_data *data,
if (bmp_decode(bmp) != BMP_OK) {
return false;
} else {
- LOG("Decoding bitmap");
+ NSLOG(netsurf, INFO, "Decoding bitmap");
guit->bitmap->modified(bmp->bitmap);
}
@@ -255,7 +255,7 @@ static void *nsico_get_internal(const struct content *c, void *context)
bmp = ico_find(ico->ico, 16, 16);
if (bmp == NULL) {
/* return error */
- LOG("Failed to select icon");
+ NSLOG(netsurf, INFO, "Failed to select icon");
return NULL;
}
diff --git a/content/handlers/image/image_cache.c b/content/handlers/image/image_cache.c
index 02107f75f..7fba11fb9 100644
--- a/content/handlers/image/image_cache.c
+++ b/content/handlers/image/image_cache.c
@@ -256,11 +256,12 @@ static void image_cache__free_bitmap(struct image_cache_entry_s *centry)
{
if (centry->bitmap != NULL) {
#ifdef IMAGE_CACHE_VERBOSE
- LOG("Freeing bitmap %p size %d age %d redraw count %d",
- centry->bitmap,
- centry->bitmap_size,
- image_cache->current_age - centry->bitmap_age,
- centry->redraw_count);
+ NSLOG(netsurf, INFO,
+ "Freeing bitmap %p size %d age %d redraw count %d",
+ centry->bitmap,
+ centry->bitmap_size,
+ image_cache->current_age - centry->bitmap_age,
+ centry->redraw_count);
#endif
guit->bitmap->destroy(centry->bitmap);
centry->bitmap = NULL;
@@ -281,7 +282,7 @@ static void image_cache__free_bitmap(struct image_cache_entry_s *centry)
static void image_cache__free_entry(struct image_cache_entry_s *centry)
{
#ifdef IMAGE_CACHE_VERBOSE
- LOG("freeing %p ", centry);
+ NSLOG(netsurf, INFO, "freeing %p ", centry);
#endif
if (centry->redraw_count == 0) {
@@ -331,7 +332,7 @@ static void image_cache__background_update(void *p)
icache->current_age += icache->params.bg_clean_time;
#ifdef IMAGE_CACHE_VERBOSE
- LOG("Cache age %ds", icache->current_age / 1000);
+ NSLOG(netsurf, INFO, "Cache age %ds", icache->current_age / 1000);
#endif
image_cache__clean(icache);
@@ -383,13 +384,16 @@ bool image_cache_speculate(struct content *c)
if ((image_cache->total_bitmap_size < image_cache->params.limit) &&
(c->size <= image_cache->params.speculative_small)) {
#ifdef IMAGE_CACHE_VERBOSE
- LOG("content size (%d) is smaller than minimum (%d)", c->size, SPECULATE_SMALL);
+ NSLOG(netsurf, INFO,
+ "content size (%d) is smaller than minimum (%d)",
+ c->size,
+ SPECULATE_SMALL);
#endif
decision = true;
}
#ifdef IMAGE_CACHE_VERBOSE
- LOG("returning %d", decision);
+ NSLOG(netsurf, INFO, "returning %d", decision);
#endif
return decision;
}
@@ -422,8 +426,10 @@ image_cache_init(const struct image_cache_parameters *image_cache_parameters)
image_cache__background_update,
image_cache);
- LOG("Image cache initialised with a limit of %" PRIsizet " hysteresis of %"PRIsizet,
- image_cache->params.limit, image_cache->params.hysteresis);
+ NSLOG(netsurf, INFO,
+ "Image cache initialised with a limit of %"PRIsizet" hysteresis of %"PRIsizet,
+ image_cache->params.limit,
+ image_cache->params.hysteresis);
return NSERROR_OK;
}
@@ -435,8 +441,8 @@ nserror image_cache_fini(void)
guit->misc->schedule(-1, image_cache__background_update, image_cache);
- LOG("Size at finish %" PRIsizet " (in %d)",
- image_cache->total_bitmap_size, image_cache->bitmap_count);
+ NSLOG(netsurf, INFO, "Size at finish %"PRIsizet" (in %d)",
+ image_cache->total_bitmap_size, image_cache->bitmap_count);
while (image_cache->entries != NULL) {
image_cache__free_entry(image_cache->entries);
@@ -446,11 +452,13 @@ nserror image_cache_fini(void)
image_cache->miss_count +
image_cache->fail_count;
- LOG("Age %ds", image_cache->current_age / 1000);
- LOG("Peak size %" PRIsizet " (in %d)",
- image_cache->max_bitmap_size, image_cache->max_bitmap_size_count);
- LOG("Peak image count %d (size %" PRIsizet ")",
- image_cache->max_bitmap_count, image_cache->max_bitmap_count_size);
+ NSLOG(netsurf, INFO, "Age %ds", image_cache->current_age / 1000);
+ NSLOG(netsurf, INFO, "Peak size %"PRIsizet" (in %d)",
+ image_cache->max_bitmap_size,
+ image_cache->max_bitmap_size_count);
+ NSLOG(netsurf, INFO, "Peak image count %d (size %"PRIsizet")",
+ image_cache->max_bitmap_count,
+ image_cache->max_bitmap_count_size);
if (op_count > 0) {
uint64_t op_size;
@@ -459,35 +467,39 @@ nserror image_cache_fini(void)
image_cache->miss_size +
image_cache->fail_size;
- LOG("Cache total/hit/miss/fail (counts) %d/%d/%d/%d (100%%/%d%%/%d%%/%d%%)",
- op_count,
- image_cache->hit_count,
- image_cache->miss_count,
- image_cache->fail_count,
- (image_cache->hit_count * 100) / op_count,
- (image_cache->miss_count * 100) / op_count,
- (image_cache->fail_count * 100) / op_count);
- LOG("Cache total/hit/miss/fail (size) %"PRIu64"/%"PRIu64"/%"PRIu64"/%"PRIu64" (100%%/%"PRId64"%%/%"PRId64"%%/%"PRId64"%%)",
- op_size,
- image_cache->hit_size,
- image_cache->miss_size,
- image_cache->fail_size,
- (image_cache->hit_size * 100) / op_size,
- (image_cache->miss_size * 100) / op_size,
- (image_cache->fail_size * 100) / op_size);
+ NSLOG(netsurf, INFO,
+ "Cache total/hit/miss/fail (counts) %d/%d/%d/%d (100%%/%d%%/%d%%/%d%%)",
+ op_count,
+ image_cache->hit_count,
+ image_cache->miss_count,
+ image_cache->fail_count,
+ (image_cache->hit_count * 100) / op_count,
+ (image_cache->miss_count * 100) / op_count,
+ (image_cache->fail_count * 100) / op_count);
+ NSLOG(netsurf, INFO,
+ "Cache total/hit/miss/fail (size) %"PRIu64"/%"PRIu64"/%"PRIu64"/%"PRIu64" (100%%/%"PRId64"%%/%"PRId64"%%/%"PRId64"%%)",
+ op_size,
+ image_cache->hit_size,
+ image_cache->miss_size,
+ image_cache->fail_size,
+ (image_cache->hit_size * 100) / op_size,
+ (image_cache->miss_size * 100) / op_size,
+ (image_cache->fail_size * 100) / op_size);
}
- LOG("Total images never rendered: %d (includes %d that were converted)",
- image_cache->total_unrendered,
- image_cache->specultive_miss_count);
+ NSLOG(netsurf, INFO,
+ "Total images never rendered: %d (includes %d that were converted)",
+ image_cache->total_unrendered,
+ image_cache->specultive_miss_count);
- LOG("Total number of excessive conversions: %d (from %d images converted more than once)",
- image_cache->total_extra_conversions,
- image_cache->total_extra_conversions_count);
+ NSLOG(netsurf, INFO,
+ "Total number of excessive conversions: %d (from %d images converted more than once)",
+ image_cache->total_extra_conversions,
+ image_cache->total_extra_conversions_count);
- LOG("Bitmap of size %d had most (%d) conversions",
- image_cache->peak_conversions_size,
- image_cache->peak_conversions);
+ NSLOG(netsurf, INFO, "Bitmap of size %d had most (%d) conversions",
+ image_cache->peak_conversions_size,
+ image_cache->peak_conversions);
free(image_cache);
@@ -519,7 +531,8 @@ nserror image_cache_add(struct content *content,
centry->bitmap_size = content->width * content->height * 4;
}
- LOG("centry %p, content %p, bitmap %p", centry, content, bitmap);
+ NSLOG(netsurf, INFO, "centry %p, content %p, bitmap %p", centry,
+ content, bitmap);
centry->convert = convert;
@@ -558,7 +571,8 @@ nserror image_cache_remove(struct content *content)
/* get the cache entry */
centry = image_cache__find(content);
if (centry == NULL) {
- LOG("Could not find cache entry for content (%p)", content);
+ NSLOG(netsurf, INFO,
+ "Could not find cache entry for content (%p)", content);
return NSERROR_NOT_FOUND;
}
@@ -788,7 +802,8 @@ bool image_cache_redraw(struct content *c,
/* get the cache entry */
centry = image_cache__find(c);
if (centry == NULL) {
- LOG("Could not find cache entry for content (%p)", c);
+ NSLOG(netsurf, INFO,
+ "Could not find cache entry for content (%p)", c);
return false;
}
@@ -827,7 +842,8 @@ void image_cache_destroy(struct content *content)
/* get the cache entry */
centry = image_cache__find(content);
if (centry == NULL) {
- LOG("Could not find cache entry for content (%p)", content);
+ NSLOG(netsurf, INFO,
+ "Could not find cache entry for content (%p)", content);
} else {
image_cache__free_entry(centry);
}
diff --git a/content/handlers/image/jpeg.c b/content/handlers/image/jpeg.c
index c5aca1c9b..44b1c5271 100644
--- a/content/handlers/image/jpeg.c
+++ b/content/handlers/image/jpeg.c
@@ -142,7 +142,7 @@ static void nsjpeg_term_source(j_decompress_ptr cinfo)
static void nsjpeg_error_log(j_common_ptr cinfo)
{
cinfo->err->format_message(cinfo, nsjpeg_error_buffer);
- LOG("%s", nsjpeg_error_buffer);
+ NSLOG(netsurf, INFO, "%s", nsjpeg_error_buffer);
}
@@ -156,7 +156,7 @@ static void nsjpeg_error_exit(j_common_ptr cinfo)
jmp_buf *setjmp_buffer = (jmp_buf *) cinfo->client_data;
cinfo->err->format_message(cinfo, nsjpeg_error_buffer);
- LOG("%s", nsjpeg_error_buffer);
+ NSLOG(netsurf, INFO, "%s", nsjpeg_error_buffer);
longjmp(*setjmp_buffer, 1);
}
diff --git a/content/handlers/image/nssprite.c b/content/handlers/image/nssprite.c
index c9fe1b585..269c24356 100644
--- a/content/handlers/image/nssprite.c
+++ b/content/handlers/image/nssprite.c
@@ -48,10 +48,10 @@ typedef struct nssprite_content {
#define ERRCHK(x) do { \
rosprite_error err = x; \
if (err == ROSPRITE_EOF) { \
- LOG("Got ROSPRITE_EOF when loading sprite file"); \
+ NSLOG(netsurf, INFO, "Got ROSPRITE_EOF when loading sprite file"); \
goto ro_sprite_error; \
} else if (err == ROSPRITE_BADMODE) { \
- LOG("Got ROSPRITE_BADMODE when loading sprite file"); \
+ NSLOG(netsurf, INFO, "Got ROSPRITE_BADMODE when loading sprite file"); \
goto ro_sprite_error; \
} else if (err == ROSPRITE_OK) { \
} else { \
diff --git a/content/handlers/image/png.c b/content/handlers/image/png.c
index 288f6c3e4..7a4ce3010 100644
--- a/content/handlers/image/png.c
+++ b/content/handlers/image/png.c
@@ -74,7 +74,7 @@ enum nspng_cberr {
*/
static void nspng_warning(png_structp png_ptr, png_const_charp warning_message)
{
- LOG("%s", warning_message);
+ NSLOG(netsurf, INFO, "%s", warning_message);
}
/**
@@ -82,7 +82,7 @@ static void nspng_warning(png_structp png_ptr, png_const_charp warning_message)
*/
static void nspng_error(png_structp png_ptr, png_const_charp error_message)
{
- LOG("%s", error_message);
+ NSLOG(netsurf, INFO, "%s", error_message);
longjmp(png_jmpbuf(png_ptr), CBERR_LIBPNG);
}
@@ -175,10 +175,8 @@ static void info_callback(png_structp png_s, png_infop info)
png_c->rowbytes = png_get_rowbytes(png_s, info);
png_c->interlace = (interlace == PNG_INTERLACE_ADAM7);
- LOG("size %li * %li, rowbytes %" PRIsizet,
- (unsigned long)width,
- (unsigned long)height,
- png_c->rowbytes);
+ NSLOG(netsurf, INFO, "size %li * %li, rowbytes %"PRIsizet,
+ (unsigned long)width, (unsigned long)height, png_c->rowbytes);
}
static void row_callback(png_structp png_s, png_bytep new_row,
@@ -260,7 +258,7 @@ static nserror nspng_create_png_data(nspng_content *png_c)
if (setjmp(png_jmpbuf(png_c->png))) {
png_destroy_read_struct(&png_c->png, &png_c->info, 0);
- LOG("Failed to set callbacks");
+ NSLOG(netsurf, INFO, "Failed to set callbacks");
png_c->png = NULL;
png_c->info = NULL;
@@ -350,7 +348,8 @@ static bool nspng_process_data(struct content *c, const char *data,
* up png conversion and signal the content
* error
*/
- LOG("Fatal PNG error during header, error content");
+ NSLOG(netsurf, INFO,
+ "Fatal PNG error during header, error content");
png_destroy_read_struct(&png_c->png, &png_c->info, 0);
png_c->png = NULL;
diff --git a/content/handlers/image/rsvg.c b/content/handlers/image/rsvg.c
index f6732e23f..ca2d81eeb 100644
--- a/content/handlers/image/rsvg.c
+++ b/content/handlers/image/rsvg.c
@@ -68,7 +68,7 @@ static nserror rsvg_create_svg_data(rsvg_content *c)
c->bitmap = NULL;
if ((c->rsvgh = rsvg_handle_new()) == NULL) {
- LOG("rsvg_handle_new() returned NULL.");
+ NSLOG(netsurf, INFO, "rsvg_handle_new() returned NULL.");
content_broadcast_errorcode(&c->base, NSERROR_NOMEM);
return NSERROR_NOMEM;
}
@@ -116,7 +116,8 @@ static bool rsvg_process_data(struct content *c, const char *data,
if (rsvg_handle_write(d->rsvgh, (const guchar *)data, (gsize)size,
&err) == FALSE) {
- LOG("rsvg_handle_write returned an error: %s", err->message);
+ NSLOG(netsurf, INFO,
+ "rsvg_handle_write returned an error: %s", err->message);
content_broadcast_errorcode(c, NSERROR_SVG_ERROR);
return false;
}
@@ -160,7 +161,8 @@ static bool rsvg_convert(struct content *c)
GError *err = NULL;
if (rsvg_handle_close(d->rsvgh, &err) == FALSE) {
- LOG("rsvg_handle_close returned an error: %s", err->message);
+ NSLOG(netsurf, INFO,
+ "rsvg_handle_close returned an error: %s", err->message);
content_broadcast_errorcode(c, NSERROR_SVG_ERROR);
return false;
}
@@ -177,7 +179,8 @@ static bool rsvg_convert(struct content *c)
if ((d->bitmap = guit->bitmap->create(c->width, c->height,
BITMAP_NEW)) == NULL) {
- LOG("Failed to create bitmap for rsvg render.");
+ NSLOG(netsurf, INFO,
+ "Failed to create bitmap for rsvg render.");
content_broadcast_errorcode(c, NSERROR_NOMEM);
return false;
}
@@ -187,13 +190,15 @@ static bool rsvg_convert(struct content *c)
CAIRO_FORMAT_ARGB32,
c->width, c->height,
guit->bitmap->get_rowstride(d->bitmap))) == NULL) {
- LOG("Failed to create Cairo image surface for rsvg render.");
+ NSLOG(netsurf, INFO,
+ "Failed to create Cairo image surface for rsvg render.");
content_broadcast_errorcode(c, NSERROR_NOMEM);
return false;
}
if ((d->ct = cairo_create(d->cs)) == NULL) {
- LOG("Failed to create Cairo drawing context for rsvg render.");
+ NSLOG(netsurf, INFO,
+ "Failed to create Cairo drawing context for rsvg render.");
content_broadcast_errorcode(c, NSERROR_NOMEM);
return false;
}
diff --git a/content/handlers/javascript/duktape/dukky.c b/content/handlers/javascript/duktape/dukky.c
index dd4378b7a..8cfeb3985 100644
--- a/content/handlers/javascript/duktape/dukky.c
+++ b/content/handlers/javascript/duktape/dukky.c
@@ -61,7 +61,8 @@ static duk_ret_t dukky_populate_object(duk_context *ctx, void *udata)
duk_get_prop(ctx, -2);
/* ... obj args prototab {proto/undefined} */
if (duk_is_undefined(ctx, -1)) {
- LOG("RuhRoh, couldn't find a prototype, HTMLUnknownElement it is");
+ NSLOG(netsurf, INFO,
+ "RuhRoh, couldn't find a prototype, HTMLUnknownElement it is");
duk_pop(ctx);
duk_push_string(ctx, PROTO_NAME(HTMLUNKNOWNELEMENT));
duk_get_prop(ctx, -2);
@@ -77,7 +78,7 @@ static duk_ret_t dukky_populate_object(duk_context *ctx, void *udata)
/* ... initfn obj[proto] args prototab proto */
duk_pop_2(ctx);
/* ... initfn obj[proto] args */
- LOG("Call the init function");
+ NSLOG(netsurf, INFO, "Call the init function");
duk_call(ctx, nargs + 1);
return 1; /* The object */
}
@@ -85,7 +86,7 @@ static duk_ret_t dukky_populate_object(duk_context *ctx, void *udata)
duk_ret_t dukky_create_object(duk_context *ctx, const char *name, int args)
{
duk_ret_t ret;
- LOG("name=%s nargs=%d", name+2, args);
+ NSLOG(netsurf, INFO, "name=%s nargs=%d", name + 2, args);
/* ... args */
duk_push_object(ctx);
/* ... args obj */
@@ -106,7 +107,7 @@ duk_ret_t dukky_create_object(duk_context *ctx, const char *name, int args)
if ((ret = duk_safe_call(ctx, dukky_populate_object, NULL, args + 3, 1))
!= DUK_EXEC_SUCCESS)
return ret;
- LOG("created");
+ NSLOG(netsurf, INFO, "created");
return DUK_EXEC_SUCCESS;
}
@@ -146,7 +147,7 @@ dukky_push_node_stacked(duk_context *ctx)
if (duk_safe_call(ctx, dukky_populate_object, NULL, 4, 1)
!= DUK_EXEC_SUCCESS) {
duk_set_top(ctx, top_at_fail);
- LOG("Boo and also hiss");
+ NSLOG(netsurf, INFO, "Boo and also hiss");
return false;
}
/* ... nodeptr klass nodes node */
@@ -384,13 +385,14 @@ dukky_push_node_klass(duk_context *ctx, struct dom_node *node)
err = dom_node_get_namespace(node, &namespace);
if (err != DOM_NO_ERR) {
/* Feck it, element */
- LOG("dom_node_get_namespace() failed");
+ NSLOG(netsurf, INFO,
+ "dom_node_get_namespace() failed");
duk_push_string(ctx, PROTO_NAME(ELEMENT));
break;
}
if (namespace == NULL) {
/* No namespace, -> element */
- LOG("no namespace");
+ NSLOG(netsurf, INFO, "no namespace");
duk_push_string(ctx, PROTO_NAME(ELEMENT));
break;
}
@@ -561,7 +563,7 @@ nserror js_newcontext(int timeout, jscallback *cb, void *cbctx,
duk_context *ctx;
jscontext *ret = calloc(1, sizeof(*ret));
*jsctx = NULL;
- LOG("Creating new duktape javascript context");
+ NSLOG(netsurf, INFO, "Creating new duktape javascript context");
if (ret == NULL) return NSERROR_NOMEM;
ctx = ret->ctx = duk_create_heap(
dukky_alloc_function,
@@ -584,7 +586,7 @@ nserror js_newcontext(int timeout, jscallback *cb, void *cbctx,
void js_destroycontext(jscontext *ctx)
{
- LOG("Destroying duktape javascript context");
+ NSLOG(netsurf, INFO, "Destroying duktape javascript context");
duk_destroy_heap(ctx->ctx);
free(ctx);
}
@@ -593,7 +595,9 @@ jsobject *js_newcompartment(jscontext *ctx, void *win_priv, void *doc_priv)
{
assert(ctx != NULL);
/* Pop any active thread off */
- LOG("Yay, new compartment, win_priv=%p, doc_priv=%p", win_priv, doc_priv);
+ NSLOG(netsurf, INFO,
+ "Yay, new compartment, win_priv=%p, doc_priv=%p", win_priv,
+ doc_priv);
duk_set_top(ctx->ctx, 0);
duk_push_thread(ctx->ctx);
ctx->thread = duk_require_context(ctx->ctx, -1);
@@ -659,15 +663,17 @@ bool js_exec(jscontext *ctx, const char *txt, size_t txtlen)
duk_get_prop_string(CTX, 0, "fileName");
duk_get_prop_string(CTX, 0, "lineNumber");
duk_get_prop_string(CTX, 0, "stack");
- LOG("Uncaught error in JS: %s: %s", duk_safe_to_string(CTX, 1),
- duk_safe_to_string(CTX, 2));
- LOG(" was at: %s line %s", duk_safe_to_string(CTX, 3),
- duk_safe_to_string(CTX, 4));
- LOG(" Stack trace: %s", duk_safe_to_string(CTX, 5));
+ NSLOG(netsurf, INFO, "Uncaught error in JS: %s: %s",
+ duk_safe_to_string(CTX, 1), duk_safe_to_string(CTX, 2));
+ NSLOG(netsurf, INFO, " was at: %s line %s",
+ duk_safe_to_string(CTX, 3), duk_safe_to_string(CTX, 4));
+ NSLOG(netsurf, INFO, " Stack trace: %s",
+ duk_safe_to_string(CTX, 5));
return false;
}
if (duk_get_top(CTX) == 0) duk_push_boolean(CTX, false);
- LOG("Returning %s", duk_get_boolean(CTX, 0) ? "true" : "false");
+ NSLOG(netsurf, INFO, "Returning %s",
+ duk_get_boolean(CTX, 0) ? "true" : "false");
return duk_get_boolean(CTX, 0);
}
@@ -782,7 +788,8 @@ bool dukky_get_current_value_of_event_handler(duk_context *ctx,
/* ... node fullhandlersrc filename */
if (duk_pcompile(ctx, DUK_COMPILE_FUNCTION) != 0) {
/* ... node err */
- LOG("Unable to proceed with handler, could not compile");
+ NSLOG(netsurf, INFO,
+ "Unable to proceed with handler, could not compile");
duk_pop_2(ctx);
return false;
}
@@ -816,29 +823,27 @@ static void dukky_generic_event_handler(dom_event *evt, void *pw)
duk_get_memory_functions(ctx, &funcs);
jsctx = funcs.udata;
- LOG("WOOP WOOP, An event:");
+ NSLOG(netsurf, INFO, "WOOP WOOP, An event:");
exc = dom_event_get_type(evt, &name);
if (exc != DOM_NO_ERR) {
- LOG("Unable to find the event name");
+ NSLOG(netsurf, INFO, "Unable to find the event name");
return;
}
- LOG("Event's name is %*s",
- dom_string_length(name), dom_string_data(name));
+ NSLOG(netsurf, INFO, "Event's name is %*s", dom_string_length(name),
+ dom_string_data(name));
exc = dom_event_get_event_phase(evt, &phase);
if (exc != DOM_NO_ERR) {
- LOG("Unable to get event phase");
+ NSLOG(netsurf, INFO, "Unable to get event phase");
return;
}
- LOG("Event phase is: %s (%d)",
- phase == DOM_CAPTURING_PHASE ? "capturing" :
- phase == DOM_AT_TARGET ? "at-target" :
- phase == DOM_BUBBLING_PHASE ? "bubbling" :
- "unknown", (int)phase);
+ NSLOG(netsurf, INFO, "Event phase is: %s (%d)",
+ phase == DOM_CAPTURING_PHASE ? "capturing" : phase == DOM_AT_TARGET ? "at-target" : phase == DOM_BUBBLING_PHASE ? "bubbling" : "unknown",
+ (int)phase);
exc = dom_event_get_current_target(evt, &targ);
if (exc != DOM_NO_ERR) {
dom_string_unref(name);
- LOG("Unable to find the event target");
+ NSLOG(netsurf, INFO, "Unable to find the event target");
return;
}
@@ -852,7 +857,8 @@ static void dukky_generic_event_handler(dom_event *evt, void *pw)
if (dukky_push_node(ctx, (dom_node *)targ) == false) {
dom_string_unref(name);
dom_node_unref(targ);
- LOG("Unable to push JS node representation?!");
+ NSLOG(netsurf, INFO,
+ "Unable to push JS node representation?!");
return;
}
/* ... node */
@@ -868,21 +874,26 @@ static void dukky_generic_event_handler(dom_event *evt, void *pw)
if (duk_pcall_method(ctx, 1) != 0) {
/* Failed to run the method */
/* ... err */
- LOG("OH NOES! An error running a callback. Meh.");
+ NSLOG(netsurf, INFO,
+ "OH NOES! An error running a callback. Meh.");
exc = dom_event_stop_immediate_propagation(evt);
if (exc != DOM_NO_ERR)
- LOG("WORSE! could not stop propagation");
+ NSLOG(netsurf, INFO,
+ "WORSE! could not stop propagation");
duk_get_prop_string(ctx, -1, "name");
duk_get_prop_string(ctx, -2, "message");
duk_get_prop_string(ctx, -3, "fileName");
duk_get_prop_string(ctx, -4, "lineNumber");
duk_get_prop_string(ctx, -5, "stack");
/* ... err name message fileName lineNumber stack */
- LOG("Uncaught error in JS: %s: %s", duk_safe_to_string(ctx, -5),
- duk_safe_to_string(ctx, -4));
- LOG(" was at: %s line %s", duk_safe_to_string(ctx, -3),
- duk_safe_to_string(ctx, -2));
- LOG(" Stack trace: %s", duk_safe_to_string(ctx, -1));
+ NSLOG(netsurf, INFO, "Uncaught error in JS: %s: %s",
+ duk_safe_to_string(ctx, -5),
+ duk_safe_to_string(ctx, -4));
+ NSLOG(netsurf, INFO, " was at: %s line %s",
+ duk_safe_to_string(ctx, -3),
+ duk_safe_to_string(ctx, -2));
+ NSLOG(netsurf, INFO, " Stack trace: %s",
+ duk_safe_to_string(ctx, -1));
duk_pop_n(ctx, 6);
/* ... */
@@ -962,21 +973,27 @@ handle_extras:
if (duk_pcall_method(ctx, 1) != 0) {
/* Failed to run the method */
/* ... copy handler err */
- LOG("OH NOES! An error running a callback. Meh.");
+ NSLOG(netsurf, INFO,
+ "OH NOES! An error running a callback. Meh.");
exc = dom_event_stop_immediate_propagation(evt);
if (exc != DOM_NO_ERR)
- LOG("WORSE! could not stop propagation");
+ NSLOG(netsurf, INFO,
+ "WORSE! could not stop propagation");
duk_get_prop_string(ctx, -1, "name");
duk_get_prop_string(ctx, -2, "message");
duk_get_prop_string(ctx, -3, "fileName");
duk_get_prop_string(ctx, -4, "lineNumber");
duk_get_prop_string(ctx, -5, "stack");
/* ... err name message fileName lineNumber stack */
- LOG("Uncaught error in JS: %s: %s", duk_safe_to_string(ctx, -5),
- duk_safe_to_string(ctx, -4));
- LOG(" was at: %s line %s", duk_safe_to_string(ctx, -3),
- duk_safe_to_string(ctx, -2));
- LOG(" Stack trace: %s", duk_safe_to_string(ctx, -1));
+ NSLOG(netsurf, INFO, "Uncaught error in JS: %s: %s",
+ duk_safe_to_string(ctx, -5),
+ duk_safe_to_string(ctx, -4));
+ NSLOG(netsurf, INFO,
+ " was at: %s line %s",
+ duk_safe_to_string(ctx, -3),
+ duk_safe_to_string(ctx, -2));
+ NSLOG(netsurf, INFO, " Stack trace: %s",
+ duk_safe_to_string(ctx, -1));
duk_pop_n(ctx, 7);
/* ... copy */
@@ -1034,11 +1051,12 @@ void dukky_register_event_listener_for(duk_context *ctx,
exc = dom_event_target_add_event_listener(
ele, name, listen, capture);
if (exc != DOM_NO_ERR) {
- LOG("Unable to register listener for %p.%*s",
- ele, dom_string_length(name), dom_string_data(name));
+ NSLOG(netsurf, INFO,
+ "Unable to register listener for %p.%*s", ele,
+ dom_string_length(name), dom_string_data(name));
} else {
- LOG("have registered listener for %p.%*s",
- ele, dom_string_length(name), dom_string_data(name));
+ NSLOG(netsurf, INFO, "have registered listener for %p.%*s",
+ ele, dom_string_length(name), dom_string_data(name));
}
dom_event_listener_unref(listen);
}
@@ -1205,7 +1223,8 @@ bool js_fire_event(jscontext *ctx, const char *type, struct dom_document *doc, s
dom_event *evt;
dom_event_target *body;
- LOG("Event: %s (doc=%p, target=%p)", type, doc, target);
+ NSLOG(netsurf, INFO, "Event: %s (doc=%p, target=%p)", type, doc,
+ target);
/** @todo Make this more generic, this only handles load and only
* targetting the window, so that we actually stand a chance of
@@ -1276,18 +1295,22 @@ bool js_fire_event(jscontext *ctx, const char *type, struct dom_document *doc, s
if (duk_pcall_method(CTX, 1) != 0) {
/* Failed to run the handler */
/* ... err */
- LOG("OH NOES! An error running a handler. Meh.");
+ NSLOG(netsurf, INFO,
+ "OH NOES! An error running a handler. Meh.");
duk_get_prop_string(CTX, -1, "name");
duk_get_prop_string(CTX, -2, "message");
duk_get_prop_string(CTX, -3, "fileName");
duk_get_prop_string(CTX, -4, "lineNumber");
duk_get_prop_string(CTX, -5, "stack");
/* ... err name message fileName lineNumber stack */
- LOG("Uncaught error in JS: %s: %s", duk_safe_to_string(CTX, -5),
- duk_safe_to_string(CTX, -4));
- LOG(" was at: %s line %s", duk_safe_to_string(CTX, -3),
- duk_safe_to_string(CTX, -2));
- LOG(" Stack trace: %s", duk_safe_to_string(CTX, -1));
+ NSLOG(netsurf, INFO, "Uncaught error in JS: %s: %s",
+ duk_safe_to_string(CTX, -5),
+ duk_safe_to_string(CTX, -4));
+ NSLOG(netsurf, INFO, " was at: %s line %s",
+ duk_safe_to_string(CTX, -3),
+ duk_safe_to_string(CTX, -2));
+ NSLOG(netsurf, INFO, " Stack trace: %s",
+ duk_safe_to_string(CTX, -1));
duk_pop_n(CTX, 6);
/* ... */