From fa546661ad7365507f8dde5d75fb27fae63f27a2 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 9 Aug 2018 16:11:18 +0100 Subject: nsurl: Move debug logging over to nslog. --- utils/nsurl/nsurl.c | 4 ---- utils/nsurl/parse.c | 36 ++++++++++++++++-------------------- utils/nsurl/private.h | 44 ++++++++++++++++---------------------------- 3 files changed, 32 insertions(+), 52 deletions(-) (limited to 'utils') diff --git a/utils/nsurl/nsurl.c b/utils/nsurl/nsurl.c index f197d6dde..4dbbe96e3 100644 --- a/utils/nsurl/nsurl.c +++ b/utils/nsurl/nsurl.c @@ -88,10 +88,6 @@ void nsurl_unref(nsurl *url) if (--url->count > 0) return; -#ifdef NSURL_DEBUG - nsurl__dump(url); -#endif - /* Release lwc strings */ nsurl__components_destroy(&url->components); diff --git a/utils/nsurl/parse.c b/utils/nsurl/parse.c index ff5f27bc3..7ce1e457b 100644 --- a/utils/nsurl/parse.c +++ b/utils/nsurl/parse.c @@ -460,21 +460,19 @@ static void nsurl__get_string_markers(const char * const url_s, marker.fragment = marker.end; } -#ifdef NSURL_DEBUG - NSLOG(netsurf, INFO, "marker.start: %i", marker.start); - NSLOG(netsurf, INFO, "marker.scheme_end: %i", marker.scheme_end); - NSLOG(netsurf, INFO, "marker.authority: %i", marker.authority); + NSLOG(netsurf, DEEPDEBUG, "marker.start: %zu", marker.start); + NSLOG(netsurf, DEEPDEBUG, "marker.scheme_end: %zu", marker.scheme_end); + NSLOG(netsurf, DEEPDEBUG, "marker.authority: %zu", marker.authority); - NSLOG(netsurf, INFO, "marker.colon_first: %i", marker.colon_first); - NSLOG(netsurf, INFO, "marker.at: %i", marker.at); - NSLOG(netsurf, INFO, "marker.colon_last: %i", marker.colon_last); + NSLOG(netsurf, DEEPDEBUG, "marker.colon_first: %zu", marker.colon_first); + NSLOG(netsurf, DEEPDEBUG, "marker.at: %zu", marker.at); + NSLOG(netsurf, DEEPDEBUG, "marker.colon_last: %zu", marker.colon_last); - NSLOG(netsurf, INFO, "marker.path: %i", marker.path); - NSLOG(netsurf, INFO, "marker.query: %i", marker.query); - NSLOG(netsurf, INFO, "marker.fragment: %i", marker.fragment); + NSLOG(netsurf, DEEPDEBUG, "marker.path: %zu", marker.path); + NSLOG(netsurf, DEEPDEBUG, "marker.query: %zu", marker.query); + NSLOG(netsurf, DEEPDEBUG, "marker.fragment: %zu", marker.fragment); - NSLOG(netsurf, INFO, "marker.end: %i", marker.end); -#endif + NSLOG(netsurf, DEEPDEBUG, "marker.end: %zu", marker.end); /* Got all the URL components pegged out now */ *markers = marker; @@ -494,10 +492,10 @@ static size_t nsurl__remove_dot_segments(char *path, char *output) char *output_pos = output; while (*path_pos != '\0') { -#ifdef NSURL_DEBUG - NSLOG(netsurf, INFO, " in:%s", path_pos); - NSLOG(netsurf, INFO, "out:%.*s", output_pos - output, output); -#endif + NSLOG(netsurf, DEEPDEBUG, " in:%s", path_pos); + NSLOG(netsurf, DEEPDEBUG, "out:%.*s", + (int)(output_pos - output), output); + if (*path_pos == '.') { if (*(path_pos + 1) == '.' && *(path_pos + 2) == '/') { @@ -1333,10 +1331,8 @@ nserror nsurl_join(const nsurl *base, const char *rel, nsurl **joined) assert(base != NULL); assert(rel != NULL); -#ifdef NSURL_DEBUG - NSLOG(netsurf, INFO, "base: \"%s\", rel: \"%s\"", nsurl_access(base), - rel); -#endif + NSLOG(netsurf, DEEPDEBUG, "base: \"%s\", rel: \"%s\"", + nsurl_access(base), rel); /* Peg out the URL sections */ nsurl__get_string_markers(rel, &m, true); diff --git a/utils/nsurl/private.h b/utils/nsurl/private.h index 8032be0c2..4366ff68c 100644 --- a/utils/nsurl/private.h +++ b/utils/nsurl/private.h @@ -25,10 +25,6 @@ #include "utils/utils.h" -/* Define to enable NSURL debugging */ -#undef NSURL_DEBUG - - /** A type for URL schemes */ enum nsurl_scheme_type { NSURL_SCHEME_OTHER, @@ -188,44 +184,36 @@ static inline void nsurl__components_destroy(struct nsurl_components *c) static inline void nsurl__dump(const nsurl *url) { if (url->components.scheme) - NSLOG(netsurf, INFO,netsurf, INFO, - " Scheme: %s", - lwc_string_data(url->components.scheme)); + NSLOG(netsurf, DEEPDEBUG, " Scheme: %s", + lwc_string_data(url->components.scheme)); if (url->components.username) - NSLOG(netsurf, INFO, - "Username: %s", - lwc_string_data(url->components.username)); + NSLOG(netsurf, DEEPDEBUG, "Username: %s", + lwc_string_data(url->components.username)); if (url->components.password) - NSLOG(netsurf, INFO, - "Password: %s", - lwc_string_data(url->components.password)); + NSLOG(netsurf, DEEPDEBUG, "Password: %s", + lwc_string_data(url->components.password)); if (url->components.host) - NSLOG(netsurf, INFO, - " Host: %s", - lwc_string_data(url->components.host)); + NSLOG(netsurf, DEEPDEBUG, " Host: %s", + lwc_string_data(url->components.host)); if (url->components.port) - NSLOG(netsurf, INFO, - " Port: %s", - lwc_string_data(url->components.port)); + NSLOG(netsurf, DEEPDEBUG, " Port: %s", + lwc_string_data(url->components.port)); if (url->components.path) - NSLOG(netsurf, INFO, - " Path: %s", - lwc_string_data(url->components.path)); + NSLOG(netsurf, DEEPDEBUG, " Path: %s", + lwc_string_data(url->components.path)); if (url->components.query) - NSLOG(netsurf, INFO, - " Query: %s", - lwc_string_data(url->components.query)); + NSLOG(netsurf, DEEPDEBUG, " Query: %s", + lwc_string_data(url->components.query)); if (url->components.fragment) - NSLOG(netsurf, INFO, - "Fragment: %s", - lwc_string_data(url->components.fragment)); + NSLOG(netsurf, DEEPDEBUG, "Fragment: %s", + lwc_string_data(url->components.fragment)); } #endif -- cgit v1.2.3