diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2017-01-22 16:11:24 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2017-02-08 17:27:13 +0000 |
commit | 3f5d8d1a2e844c8833eeb046fd7a84b72a3d3a1f (patch) | |
tree | 1b4908b8124fee0b70c22ed5102040ac438ea2b9 /utils/nsurl/private.h | |
parent | 5c8f4c9c8c98c0af71dfb2e41d8947a6edf09f47 (diff) | |
download | netsurf-3f5d8d1a2e844c8833eeb046fd7a84b72a3d3a1f.tar.gz netsurf-3f5d8d1a2e844c8833eeb046fd7a84b72a3d3a1f.tar.bz2 |
nsurl: Tidy up shared components code.
Diffstat (limited to 'utils/nsurl/private.h')
-rw-r--r-- | utils/nsurl/private.h | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/utils/nsurl/private.h b/utils/nsurl/private.h index 67945e2e7..e78f83042 100644 --- a/utils/nsurl/private.h +++ b/utils/nsurl/private.h @@ -128,7 +128,7 @@ enum nsurl_string_flags { * \param[out] url_l_out Returns byte length of string, excluding pre_padding. * \return NSERROR_OK on success, appropriate error otherwise. */ -nserror nsurl__string( +nserror nsurl__components_to_string( const struct nsurl_components *components, nsurl_component parts, size_t pre_padding, char **url_s_out, size_t *url_l_out); @@ -142,6 +142,41 @@ void nsurl__calc_hash(nsurl *url); + +/** + * Destroy components + * + * \param c url components + */ +static inline void nsurl__components_destroy(struct nsurl_components *c) +{ + if (c->scheme) + lwc_string_unref(c->scheme); + + if (c->username) + lwc_string_unref(c->username); + + if (c->password) + lwc_string_unref(c->password); + + if (c->host) + lwc_string_unref(c->host); + + if (c->port) + lwc_string_unref(c->port); + + if (c->path) + lwc_string_unref(c->path); + + if (c->query) + lwc_string_unref(c->query); + + if (c->fragment) + lwc_string_unref(c->fragment); +} + + + #ifdef NSURL_DEBUG /** * Dump a NetSurf URL's internal components |