From 642d773e2f5da9c3a238e4ed37a3fda14179f4dc Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 8 Oct 2011 12:03:54 +0000 Subject: Add function to get at url length. svn path=/trunk/netsurf/; revision=13003 --- utils/nsurl.c | 9 +++++++++ utils/nsurl.h | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/utils/nsurl.c b/utils/nsurl.c index bae757324..328513364 100644 --- a/utils/nsurl.c +++ b/utils/nsurl.c @@ -1435,6 +1435,15 @@ const char *nsurl_access(const nsurl *url) } +/* exported interface, documented in nsurl.h */ +size_t nsurl_length(const nsurl *url) +{ + assert(url != NULL); + + return url->length; +} + + /* exported interface, documented in nsurl.h */ nserror nsurl_join(const nsurl *base, const char *rel, nsurl **joined) { diff --git a/utils/nsurl.h b/utils/nsurl.h index ceb29bc97..c708e0483 100644 --- a/utils/nsurl.h +++ b/utils/nsurl.h @@ -182,6 +182,17 @@ bool nsurl_enquire(const nsurl *url, nsurl_component part); const char *nsurl_access(const nsurl *url); +/** + * Find the length of a NetSurf URL object's URL, as returned by nsurl_access + * + * \param url NetSurf URL to find length of. + * \return the required string + * + * The returned length excludes the trailing '\0'. + */ +size_t nsurl_length(const nsurl *url); + + /** * Join a base url to a relative link part, creating a new NetSurf URL object * -- cgit v1.2.3