aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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)
{