summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-05-24 18:56:42 +0000
committerDavid Robillard <d@drobilla.net>2011-05-24 18:56:42 +0000
commitdbd8fdc5bb5f50ff030259d1ea5a382325658e43 (patch)
tree4bfa5a470315d98af7ccac6cbb4dfc03be8a3043
parent876c5e305254158827ca5f70d7ec138af3f09ff0 (diff)
downloadlilv-dbd8fdc5bb5f50ff030259d1ea5a382325658e43.tar.gz
lilv-dbd8fdc5bb5f50ff030259d1ea5a382325658e43.tar.bz2
lilv-dbd8fdc5bb5f50ff030259d1ea5a382325658e43.zip
Re-use the SordNode of blank nodes when copying.
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@3309 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/node.c11
-rw-r--r--src/util.c11
-rw-r--r--src/world.c3
3 files changed, 10 insertions, 15 deletions
diff --git a/src/node.c b/src/node.c
index e410a11..918bdd0 100644
--- a/src/node.c
+++ b/src/node.c
@@ -105,6 +105,13 @@ lilv_node_new_from_node(LilvWorld* world, const SordNode* node)
result->val.uri_val = sord_node_copy(node);
result->str_val = (char*)sord_node_get_string(result->val.uri_val);
break;
+ case SORD_BLANK:
+ result = malloc(sizeof(struct LilvNodeImpl));
+ result->world = (LilvWorld*)world;
+ result->type = LILV_VALUE_BLANK;
+ result->val.uri_val = sord_node_copy(node);
+ result->str_val = (char*)sord_node_get_string(result->val.uri_val);
+ break;
case SORD_LITERAL:
datatype_uri = sord_node_get_datatype(node);
if (datatype_uri) {
@@ -129,10 +136,6 @@ lilv_node_new_from_node(LilvWorld* world, const SordNode* node)
break;
}
break;
- case SORD_BLANK:
- result = lilv_node_new(world, LILV_VALUE_BLANK,
- (const char*)sord_node_get_string(node));
- break;
default:
assert(false);
}
diff --git a/src/util.c b/src/util.c
index 9f04a2d..91a9f33 100644
--- a/src/util.c
+++ b/src/util.c
@@ -62,16 +62,7 @@ lilv_strdup(const char* str)
const char*
lilv_uri_to_path(const char* uri)
{
-#ifdef __WIN32__
- if (!strncmp(uri, "file:///", (size_t)8)) {
- return (char*)(uri + 8);
- }
-#else
- if (!strncmp(uri, "file://", (size_t)7)) {
- return (char*)(uri + 7);
- }
-#endif
- return NULL;
+ return (const char*)serd_uri_to_path((const uint8_t*)uri);
}
/** Return the current LANG converted to Turtle (i.e. RFC3066) style.
diff --git a/src/world.c b/src/world.c
index 12baf15..e2456dd 100644
--- a/src/world.c
+++ b/src/world.c
@@ -353,7 +353,7 @@ lilv_world_add_plugin(LilvWorld* world,
}
// Create LilvPlugin
- LilvNode* bundle_uri = lilv_node_new_from_node(world, bundle_node);
+ LilvNode* bundle_uri = lilv_node_new_from_node(world, bundle_node);
LilvPlugin* plugin = lilv_plugin_new(world, plugin_uri, bundle_uri);
// Add manifest as plugin data file (as if it were rdfs:seeAlso)
@@ -514,6 +514,7 @@ lilv_world_load_bundle(LilvWorld* world, LilvNode* bundle_uri)
serd_reader_add_blank_prefix(reader, lilv_world_blank_node_prefix(world));
SerdStatus st = serd_reader_read_file(reader, manifest_uri.buf);
+ serd_reader_free(reader);
serd_env_free(env);
if (st) {
LILV_ERRORF("Error reading %s\n", manifest_uri.buf);