nsurl: Move debug logging over to nslog.

This commit is contained in:
Michael Drake 2018-08-09 16:11:18 +01:00
parent add6dcc015
commit fa546661ad
3 changed files with 32 additions and 52 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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