aboutsummaryrefslogtreecommitdiffstats
path: root/src/node.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/node.c')
-rw-r--r--src/node.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/node.c b/src/node.c
index 49c8518b..e09ca232 100644
--- a/src/node.c
+++ b/src/node.c
@@ -35,6 +35,12 @@
# endif
#endif
+char*
+serd_node_buffer(SerdNode* node)
+{
+ return (char*)(node + 1);
+}
+
SerdNode
serd_node_from_string(SerdType type, const char* str)
{
@@ -115,8 +121,9 @@ serd_node_new_uri_from_node(const SerdNode* uri_node,
const SerdURI* base,
SerdURI* out)
{
- return (uri_node->type == SERD_URI && uri_node->buf)
- ? serd_node_new_uri_from_string(uri_node->buf, base, out)
+ const char* uri_str = serd_node_get_string(uri_node);
+ return (uri_node->type == SERD_URI && uri_str)
+ ? serd_node_new_uri_from_string(uri_str, base, out)
: SERD_NODE_NULL;
}
@@ -382,13 +389,13 @@ serd_node_get_type(const SerdNode* node)
const char*
serd_node_get_string(const SerdNode* node)
{
- return node->buf;
+ return node ? node->buf : NULL;
}
size_t
serd_node_get_length(const SerdNode* node)
{
- return node->n_bytes;
+ return node ? node->n_bytes : 0;
}
SerdNodeFlags