summaryrefslogtreecommitdiff
path: root/utils
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 /utils
parent5c6a0eda3b42d98f7f7aeab94b96021128c298c4 (diff)
downloadnetsurf-20b3c408167b2093f1d2d68792550ff6ec44aabd.tar.gz
netsurf-20b3c408167b2093f1d2d68792550ff6ec44aabd.tar.bz2
make nsurl_defragment() API more obvious and remove duplicated parameter checking
Diffstat (limited to 'utils')
-rw-r--r--utils/nsurl.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/utils/nsurl.c b/utils/nsurl.c
index ae0c4829b..c99b0d34a 100644
--- a/utils/nsurl.c
+++ b/utils/nsurl.c
@@ -1911,6 +1911,15 @@ nserror nsurl_defragment(const nsurl *url, nsurl **no_frag)
size_t length;
char *pos;
+ /* check for source url having no fragment already */
+ if (url->components.fragment == NULL) {
+ *no_frag = (nsurl *)url;
+
+ (*no_frag)->count++;
+
+ return NSERROR_OK;
+ }
+
/* Find the change in length from url to new_url */
length = url->length;
if (url->components.fragment != NULL) {