aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/world.c14
-rw-r--r--src/world.h10
2 files changed, 16 insertions, 8 deletions
diff --git a/src/world.c b/src/world.c
index 5af8c3d4..58efac90 100644
--- a/src/world.c
+++ b/src/world.c
@@ -79,6 +79,7 @@ serd_world_new(void)
const SerdStringView xsd_decimal = SERD_STRING(NS_XSD "decimal");
const SerdStringView xsd_integer = SERD_STRING(NS_XSD "integer");
+ world->nodes = nodes;
world->rdf_first = serd_nodes_uri(nodes, rdf_first);
world->rdf_nil = serd_nodes_uri(nodes, rdf_nil);
world->rdf_rest = serd_nodes_uri(nodes, rdf_rest);
@@ -87,8 +88,10 @@ serd_world_new(void)
world->xsd_decimal = serd_nodes_uri(nodes, xsd_decimal);
world->xsd_integer = serd_nodes_uri(nodes, xsd_integer);
- world->blank_node = serd_new_token(SERD_BLANK, SERD_STRING("b00000000000"));
- world->nodes = nodes;
+ serd_node_construct_token(sizeof(world->blank),
+ &world->blank,
+ SERD_BLANK,
+ SERD_STRING("b00000000000"));
world->stderr_color = terminal_supports_color(stderr);
@@ -99,7 +102,6 @@ void
serd_world_free(SerdWorld* const world)
{
if (world) {
- serd_node_free(world->blank_node);
serd_nodes_free(world->nodes);
free(world);
}
@@ -114,11 +116,11 @@ serd_world_nodes(SerdWorld* const world)
const SerdNode*
serd_world_get_blank(SerdWorld* const world)
{
- char* buf = serd_node_buffer(world->blank_node);
+ char* buf = world->blank.string;
memset(buf, 0, BLANK_CHARS + 1);
- world->blank_node->length =
+ world->blank.node.length =
(size_t)snprintf(buf, BLANK_CHARS + 1, "b%u", ++world->next_blank_id);
- return world->blank_node;
+ return &world->blank.node;
}
diff --git a/src/world.h b/src/world.h
index 8043663e..8cc99e61 100644
--- a/src/world.h
+++ b/src/world.h
@@ -17,6 +17,7 @@
#ifndef SERD_WORLD_H
#define SERD_WORLD_H
+#include "node.h"
#include "serd/serd.h"
#include <stdbool.h>
@@ -26,7 +27,6 @@ struct SerdWorldImpl {
SerdNodes* nodes;
SerdLogFunc log_func;
void* log_handle;
- SerdNode* blank_node;
const SerdNode* rdf_first;
const SerdNode* rdf_nil;
const SerdNode* rdf_rest;
@@ -34,7 +34,13 @@ struct SerdWorldImpl {
const SerdNode* xsd_boolean;
const SerdNode* xsd_decimal;
const SerdNode* xsd_integer;
- uint32_t next_blank_id;
+
+ struct {
+ SerdNode node;
+ char string[16];
+ } blank;
+
+ uint32_t next_blank_id;
bool stderr_color;
};