summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2014-03-05 15:10:02 +0000
committerVincent Sanders <vince@kyllikki.org>2014-03-09 16:20:53 +0000
commit20b3c408167b2093f1d2d68792550ff6ec44aabd (patch)
tree569dc88041394c49d7c3e6cad3ee1292ca5ea8f2 /content
parent5c6a0eda3b42d98f7f7aeab94b96021128c298c4 (diff)
downloadnetsurf-20b3c408167b2093f1d2d68792550ff6ec44aabd.tar.gz
netsurf-20b3c408167b2093f1d2d68792550ff6ec44aabd.tar.bz2
make nsurl_defragment() API more obvious and remove duplicated parameter checking
Diffstat (limited to 'content')
-rw-r--r--content/llcache.c10
-rw-r--r--content/urldb.c19
2 files changed, 8 insertions, 21 deletions
diff --git a/content/llcache.c b/content/llcache.c
index bd7ae937e..a6e46bf29 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -1098,13 +1098,9 @@ static nserror llcache_object_retrieve(nsurl *url, uint32_t flags,
has_query = nsurl_has_component(url, NSURL_QUERY);
/* Get rid of any url fragment */
- if (nsurl_has_component(url, NSURL_FRAGMENT)) {
- error = nsurl_defragment(url, &defragmented_url);
- if (error != NSERROR_OK)
- return error;
- } else {
- defragmented_url = nsurl_ref(url);
- }
+ error = nsurl_defragment(url, &defragmented_url);
+ if (error != NSERROR_OK)
+ return error;
if (flags & LLCACHE_RETRIEVE_FORCE_FETCH || post != NULL) {
/* Create new object */
diff --git a/content/urldb.c b/content/urldb.c
index f55a1c291..1e17ac575 100644
--- a/content/urldb.c
+++ b/content/urldb.c
@@ -1806,14 +1806,9 @@ struct path_data *urldb_add_path(lwc_string *scheme, unsigned int port,
free(path_query);
if (d && !d->url) {
- /* Insert URL */
- if (nsurl_has_component(url, NSURL_FRAGMENT)) {
- nserror err = nsurl_defragment(url, &d->url);
- if (err != NSERROR_OK)
- return NULL;
- } else {
- d->url = nsurl_ref(url);
- }
+ /* Insert defragmented URL */
+ if (nsurl_defragment(url, &d->url) != NSERROR_OK)
+ return NULL;
}
return d;
@@ -2728,12 +2723,8 @@ bool urldb_set_cookie(const char *header, nsurl *url, nsurl *referer)
assert(url && header);
/* Get defragmented URL, as 'urlt' */
- if (nsurl_has_component(url, NSURL_FRAGMENT)) {
- if (nsurl_defragment(url, &urlt) != NSERROR_OK)
- return NULL;
- } else {
- urlt = nsurl_ref(url);
- }
+ if (nsurl_defragment(url, &urlt) != NSERROR_OK)
+ return NULL;
scheme = nsurl_get_component(url, NSURL_SCHEME);
if (scheme == NULL) {