aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-08-12 15:23:49 +0200
committerDavid Robillard <d@drobilla.net>2021-03-08 23:23:06 -0500
commitbf01cef66e561ea0cd2ad0babf08194b00f84b77 (patch)
tree67bca98c4769a3806e715cedff5bcfabb816e367
parent7d69e5aef5203e66d5730ccf8aed1d7596ddcb2e (diff)
downloadserd-bf01cef66e561ea0cd2ad0babf08194b00f84b77.tar.gz
serd-bf01cef66e561ea0cd2ad0babf08194b00f84b77.tar.bz2
serd-bf01cef66e561ea0cd2ad0babf08194b00f84b77.zip
Move local URI utility functions
-rw-r--r--src/node.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/src/node.c b/src/node.c
index 30f8e982..51dc8828 100644
--- a/src/node.c
+++ b/src/node.c
@@ -87,6 +87,34 @@ serd_node_check_padding(const SerdNode* node)
#endif
}
+static size_t
+serd_uri_string_length(const SerdURIView* uri)
+{
+ size_t len = uri->path_prefix.len;
+
+#define ADD_LEN(field, n_delims) \
+ if ((field).len) { \
+ len += (field).len + (n_delims); \
+ }
+
+ ADD_LEN(uri->path, 1) // + possible leading `/'
+ ADD_LEN(uri->scheme, 1) // + trailing `:'
+ ADD_LEN(uri->authority, 2) // + leading `//'
+ ADD_LEN(uri->query, 1) // + leading `?'
+ ADD_LEN(uri->fragment, 1) // + leading `#'
+
+ return len + 2; // + 2 for authority `//'
+}
+
+static size_t
+string_sink(const void* buf, size_t size, size_t nmemb, void* stream)
+{
+ char** ptr = (char**)stream;
+ memcpy(*ptr, buf, size * nmemb);
+ *ptr += size * nmemb;
+ return nmemb;
+}
+
size_t
serd_node_total_size(const SerdNode* node)
{
@@ -369,34 +397,6 @@ serd_node_equals(const SerdNode* a, const SerdNode* b)
return serd_node_total_size(b) == a_size && !memcmp(a, b, a_size);
}
-static size_t
-serd_uri_string_length(const SerdURIView* uri)
-{
- size_t len = uri->path_prefix.len;
-
-#define ADD_LEN(field, n_delims) \
- if ((field).len) { \
- len += (field).len + (n_delims); \
- }
-
- ADD_LEN(uri->path, 1) // + possible leading `/'
- ADD_LEN(uri->scheme, 1) // + trailing `:'
- ADD_LEN(uri->authority, 2) // + leading `//'
- ADD_LEN(uri->query, 1) // + leading `?'
- ADD_LEN(uri->fragment, 1) // + leading `#'
-
- return len + 2; // + 2 for authority `//'
-}
-
-static size_t
-string_sink(const void* buf, size_t size, size_t nmemb, void* stream)
-{
- char** ptr = (char**)stream;
- memcpy(*ptr, buf, size * nmemb);
- *ptr += size * nmemb;
- return nmemb;
-}
-
SerdNode*
serd_new_uri(const SerdStringView str)
{