diff options
author | David Robillard <d@drobilla.net> | 2018-10-28 14:15:28 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2018-12-31 11:37:48 -0500 |
commit | 315268f9ed6df68d9a6e3a33c6c77051b6408099 (patch) | |
tree | 42328590f8f4b77930ebe9eeba500ac5e74862cd /src/world.c | |
parent | b4a73bd563cbc572bdfd749a764e0989aa7fbe71 (diff) | |
download | serd-315268f9ed6df68d9a6e3a33c6c77051b6408099.tar.gz serd-315268f9ed6df68d9a6e3a33c6c77051b6408099.tar.bz2 serd-315268f9ed6df68d9a6e3a33c6c77051b6408099.zip |
Cache commonly used nodes in the world
Diffstat (limited to 'src/world.c')
-rw-r--r-- | src/world.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/world.c b/src/world.c index d43a2909..21bce2f3 100644 --- a/src/world.c +++ b/src/world.c @@ -21,6 +21,7 @@ #include "cursor.h" #include "node.h" #include "serd_config.h" +#include "serd_internal.h" #include <errno.h> #include <stdarg.h> @@ -83,8 +84,18 @@ SerdWorld* serd_world_new(void) { SerdWorld* world = (SerdWorld*)calloc(1, sizeof(SerdWorld)); + SerdNodes* nodes = serd_nodes_new(); + + world->rdf_first = serd_nodes_manage(nodes, serd_new_uri(NS_RDF "first")); + world->rdf_nil = serd_nodes_manage(nodes, serd_new_uri(NS_RDF "nil")); + world->rdf_rest = serd_nodes_manage(nodes, serd_new_uri(NS_RDF "rest")); + world->rdf_type = serd_nodes_manage(nodes, serd_new_uri(NS_RDF "type")); + world->xsd_boolean = serd_nodes_manage(nodes, serd_new_uri(NS_XSD "boolean")); + world->xsd_decimal = serd_nodes_manage(nodes, serd_new_uri(NS_XSD "decimal")); + world->xsd_integer = serd_nodes_manage(nodes, serd_new_uri(NS_XSD "integer")); world->blank_node = serd_new_blank("b0000000000"); + world->nodes = nodes; return world; } @@ -93,6 +104,7 @@ void serd_world_free(SerdWorld* world) { serd_node_free(world->blank_node); + serd_nodes_free(world->nodes); free(world); } |