From 5c8f4c9c8c98c0af71dfb2e41d8947a6edf09f47 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sun, 22 Jan 2017 16:03:10 +0000 Subject: nsurl: Rationalise debug build option. --- utils/nsurl/private.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'utils/nsurl/private.h') diff --git a/utils/nsurl/private.h b/utils/nsurl/private.h index a5291af21..67945e2e7 100644 --- a/utils/nsurl/private.h +++ b/utils/nsurl/private.h @@ -24,6 +24,11 @@ #include "utils/nsurl.h" #include "utils/utils.h" + +/* Define to enable NSURL debugging */ +#undef NSURL_DEBUG + + /** A type for URL schemes */ enum nsurl_scheme_type { NSURL_SCHEME_OTHER, @@ -135,4 +140,41 @@ nserror nsurl__string( */ void nsurl__calc_hash(nsurl *url); + + +#ifdef NSURL_DEBUG +/** + * Dump a NetSurf URL's internal components + * + * \param url The NetSurf URL to dump components of + */ +static inline void nsurl__dump(const nsurl *url) +{ + if (url->components.scheme) + LOG(" Scheme: %s", lwc_string_data(url->components.scheme)); + + if (url->components.username) + LOG("Username: %s", lwc_string_data(url->components.username)); + + if (url->components.password) + LOG("Password: %s", lwc_string_data(url->components.password)); + + if (url->components.host) + LOG(" Host: %s", lwc_string_data(url->components.host)); + + if (url->components.port) + LOG(" Port: %s", lwc_string_data(url->components.port)); + + if (url->components.path) + LOG(" Path: %s", lwc_string_data(url->components.path)); + + if (url->components.query) + LOG(" Query: %s", lwc_string_data(url->components.query)); + + if (url->components.fragment) + LOG("Fragment: %s", lwc_string_data(url->components.fragment)); +} +#endif + + #endif -- cgit v1.2.3