aboutsummaryrefslogtreecommitdiffstats
path: root/src/serdi.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-01-25 20:14:51 +0000
committerDavid Robillard <d@drobilla.net>2011-01-25 20:14:51 +0000
commit839dd67ed1716c2548e270160033b01d54dab03a (patch)
tree8e1d2296611b785623259f63466aa1dcc6f59a86 /src/serdi.c
parentee5b1d33acf8cf499bc0f3e3a02ad6262b4a3d05 (diff)
downloadserd-839dd67ed1716c2548e270160033b01d54dab03a.tar.gz
serd-839dd67ed1716c2548e270160033b01d54dab03a.tar.bz2
serd-839dd67ed1716c2548e270160033b01d54dab03a.zip
Move node functions into API.
git-svn-id: http://svn.drobilla.net/serd/trunk@75 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src/serdi.c')
-rw-r--r--src/serdi.c58
1 files changed, 0 insertions, 58 deletions
diff --git a/src/serdi.c b/src/serdi.c
index 27a4d9ed..496531b5 100644
--- a/src/serdi.c
+++ b/src/serdi.c
@@ -29,64 +29,6 @@ typedef struct {
SerdURI base_uri;
} State;
-static size_t
-serd_uri_string_length(const SerdURI* uri)
-{
- size_t len = uri->path_base.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;
-}
-
-static size_t
-string_sink(const void* buf, size_t len, void* stream)
-{
- uint8_t** ptr = (uint8_t**)stream;
- memcpy(*ptr, buf, len);
- *ptr += len;
- return len;
-}
-
-// FIXME: doesn't belong here
-static SerdNode
-serd_node_new_uri(const SerdURI* uri, SerdURI* out)
-{
- const size_t len = serd_uri_string_length(uri);
- uint8_t* buf = malloc(len + 1);
-
- SerdNode node = { SERD_URI, len + 1, len, buf }; // FIXME: UTF-8
-
- uint8_t* ptr = buf;
- const size_t actual_len = serd_uri_serialise(uri, string_sink, &ptr);
-
- buf[actual_len] = '\0';
- node.n_bytes = actual_len + 1;
- node.n_chars = actual_len;
-
- // FIXME: double parse
- if (!serd_uri_parse(buf, out)) {
- fprintf(stderr, "error parsing URI\n");
- return SERD_NODE_NULL;
- }
-
- return node;
-}
-
-// FIXME: doesn't belong here
-static void
-serd_node_free(SerdNode* node)
-{
- free((uint8_t*)node->buf); // FIXME: ick, const cast
-}
-
static uint8_t*
copy_string(const uint8_t* str, size_t* n_bytes)
{