diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2017-01-19 23:33:53 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2017-02-08 17:27:13 +0000 |
commit | 2acd90e28a37a80f20e2780be7972764c699d9a0 (patch) | |
tree | 3b573bfb3d2a1586112e8ec7239bb0e5ca1c2be9 /utils/nsurl/nsurl.c | |
parent | 95e5ede775fc842324b87d797ca00c7576b9a359 (diff) | |
download | netsurf-2acd90e28a37a80f20e2780be7972764c699d9a0.tar.gz netsurf-2acd90e28a37a80f20e2780be7972764c699d9a0.tar.bz2 |
nsurl: Consolidate conversion to string.
Diffstat (limited to 'utils/nsurl/nsurl.c')
-rw-r--r-- | utils/nsurl/nsurl.c | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/utils/nsurl/nsurl.c b/utils/nsurl/nsurl.c index b60eb07ca..79dc71663 100644 --- a/utils/nsurl/nsurl.c +++ b/utils/nsurl/nsurl.c @@ -248,29 +248,9 @@ bool nsurl_compare(const nsurl *url1, const nsurl *url2, nsurl_component parts) nserror nsurl_get(const nsurl *url, nsurl_component parts, char **url_s, size_t *url_l) { - struct nsurl_component_lengths str_len = { 0, 0, 0, 0, 0, 0, 0, 0 }; - enum nsurl_string_flags str_flags = 0; - assert(url != NULL); - /* Get the string length and find which parts of url need copied */ - nsurl__get_string_data(&(url->components), parts, url_l, - &str_len, &str_flags); - - if (*url_l == 0) { - return NSERROR_BAD_URL; - } - - /* Allocate memory for url string */ - *url_s = malloc(*url_l + 1); /* adding 1 for '\0' */ - if (*url_s == NULL) { - return NSERROR_NOMEM; - } - - /* Copy the required parts into the url string */ - nsurl__get_string(&(url->components), *url_s, &str_len, str_flags); - - return NSERROR_OK; + return nsurl__string(&(url->components), parts, 0, url_s, url_l); } |