summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-01-31 05:30:10 +0000
committerDavid Robillard <d@drobilla.net>2011-01-31 05:30:10 +0000
commit87c10c7cec29665aef891e4236e748a4fbed3030 (patch)
treed3a22f2e677611c9f567fb56d86bc4e136c742fa /src
parentd81b0c688ddb864fe6ebfee818dc1af76c7bc97b (diff)
downloadlilv-87c10c7cec29665aef891e4236e748a4fbed3030.tar.gz
lilv-87c10c7cec29665aef891e4236e748a4fbed3030.tar.bz2
lilv-87c10c7cec29665aef891e4236e748a4fbed3030.zip
librdf_new_node_from_node => slv2_node_copy.
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@2888 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/plugin.c6
-rw-r--r--src/port.c18
-rw-r--r--src/query.c6
-rw-r--r--src/slv2_internal.h3
-rw-r--r--src/value.c4
-rw-r--r--src/world.c81
6 files changed, 60 insertions, 58 deletions
diff --git a/src/plugin.c b/src/plugin.c
index 5ca27e4..c8292cb 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -368,7 +368,7 @@ slv2_plugin_get_class(SLV2Plugin p)
p->world->rdf_a_node,
NULL);
FOREACH_MATCH(results) {
- librdf_node* class_node = librdf_new_node_from_node(MATCH_OBJECT(results));
+ librdf_node* class_node = slv2_node_copy(MATCH_OBJECT(results));
if (!librdf_node_is_resource(class_node)) {
continue;
}
@@ -521,7 +521,7 @@ slv2_plugin_get_value_for_subject(SLV2Plugin p,
}
librdf_node* subject_node = (slv2_value_is_uri(subject))
- ? librdf_new_node_from_node(subject->val.uri_val)
+ ? slv2_node_copy(subject->val.uri_val)
: librdf_new_node_from_blank_identifier(
p->world->world, (const uint8_t*)slv2_value_as_blank(subject));
@@ -762,7 +762,7 @@ slv2_plugin_get_author(SLV2Plugin p)
return NULL;
}
- librdf_node* author = librdf_new_node_from_node(MATCH_OBJECT(maintainers));
+ librdf_node* author = slv2_node_copy(MATCH_OBJECT(maintainers));
librdf_free_stream(maintainers);
return author;
diff --git a/src/port.c b/src/port.c
index a1c9046..b5fa57c 100644
--- a/src/port.c
+++ b/src/port.c
@@ -70,23 +70,23 @@ slv2_port_get_node(SLV2Plugin p,
{
SLV2Matches ports = slv2_plugin_find_statements(
p,
- librdf_new_node_from_node(p->plugin_uri->val.uri_val),
- librdf_new_node_from_node(p->world->lv2_port_node),
+ slv2_node_copy(p->plugin_uri->val.uri_val),
+ slv2_node_copy(p->world->lv2_port_node),
NULL);
librdf_node* ret = NULL;
FOREACH_MATCH(ports) {
librdf_node* node = MATCH_OBJECT(ports);
SLV2Value symbol = slv2_plugin_get_unique(
p,
- librdf_new_node_from_node(node),
- librdf_new_node_from_node(p->world->lv2_symbol_node));
+ slv2_node_copy(node),
+ slv2_node_copy(p->world->lv2_symbol_node));
const bool matches = slv2_value_equals(symbol,
slv2_port_get_symbol(p, port));
slv2_value_free(symbol);
if (matches) {
- ret = librdf_new_node_from_node(node);
+ ret = slv2_node_copy(node);
break;
}
}
@@ -329,13 +329,13 @@ slv2_port_get_scale_points(SLV2Plugin p,
SLV2Value value = slv2_plugin_get_unique(
p,
- librdf_new_node_from_node(point),
- librdf_new_node_from_node(p->world->rdf_value_node));
+ slv2_node_copy(point),
+ slv2_node_copy(p->world->rdf_value_node));
SLV2Value label = slv2_plugin_get_unique(
p,
- librdf_new_node_from_node(point),
- librdf_new_node_from_node(p->world->rdfs_label_node));
+ slv2_node_copy(point),
+ slv2_node_copy(p->world->rdfs_label_node));
if (value && label) {
raptor_sequence_push(ret, slv2_scale_point_new(value, label));
diff --git a/src/query.c b/src/query.c
index e9121e3..085ed04 100644
--- a/src/query.c
+++ b/src/query.c
@@ -38,9 +38,9 @@ slv2_plugin_find_statements(SLV2Plugin plugin,
slv2_plugin_load_if_necessary(plugin);
librdf_statement* q = librdf_new_statement_from_nodes(
plugin->world->world,
- subject ? librdf_new_node_from_node(subject) : NULL,
- predicate ? librdf_new_node_from_node(predicate) : NULL,
- object ? librdf_new_node_from_node(object) : NULL);
+ subject ? slv2_node_copy(subject) : NULL,
+ predicate ? slv2_node_copy(predicate) : NULL,
+ object ? slv2_node_copy(object) : NULL);
librdf_stream* results = librdf_model_find_statements(plugin->rdf, q);
librdf_free_statement(q);
return results;
diff --git a/src/slv2_internal.h b/src/slv2_internal.h
index eba23b7..b4e919b 100644
--- a/src/slv2_internal.h
+++ b/src/slv2_internal.h
@@ -259,6 +259,9 @@ SLV2Value slv2_value_new_librdf_node(SLV2World world, librdf_node* node);
SLV2Value slv2_value_new_librdf_uri(SLV2World world, librdf_node* node);
librdf_uri* slv2_value_as_librdf_uri(SLV2Value value);
+static inline librdf_node* slv2_node_copy(librdf_node* node) {
+ return librdf_new_node_from_node(node);
+}
/* ********* Values ********* */
diff --git a/src/value.c b/src/value.c
index 4f9d606..59b3605 100644
--- a/src/value.c
+++ b/src/value.c
@@ -151,7 +151,7 @@ slv2_value_new_librdf_uri(SLV2World world, librdf_node* node)
assert(node && librdf_node_is_resource(node));
SLV2Value val = (SLV2Value)malloc(sizeof(struct _SLV2Value));
val->type = SLV2_VALUE_URI;
- val->val.uri_val = librdf_new_node_from_node(node);
+ val->val.uri_val = slv2_node_copy(node);
val->str_val = (char*)librdf_uri_as_string(
librdf_node_get_uri(val->val.uri_val));
return val;
@@ -204,7 +204,7 @@ slv2_value_duplicate(SLV2Value val)
result->type = val->type;
if (val->type == SLV2_VALUE_URI) {
- result->val.uri_val = librdf_new_node_from_node(val->val.uri_val);
+ result->val.uri_val = slv2_node_copy(val->val.uri_val);
result->str_val = (char*)librdf_uri_as_string(
librdf_node_get_uri(val->val.uri_val));
} else {
diff --git a/src/world.c b/src/world.c
index 10de772..3260419 100644
--- a/src/world.c
+++ b/src/world.c
@@ -263,14 +263,14 @@ slv2_world_load_bundle(SLV2World world, SLV2Value bundle_uri)
SLV2Matches dmanifests = slv2_world_find_statements(
world, world->model,
NULL,
- librdf_new_node_from_node(world->rdf_a_node),
- librdf_new_node_from_node(world->dyn_manifest_node));
+ slv2_node_copy(world->rdf_a_node),
+ slv2_node_copy(world->dyn_manifest_node));
FOREACH_MATCH(dmanifests) {
librdf_node* dmanifest = MATCH_SUBJECT(dmanifests);
SLV2Matches binaries = slv2_world_find_statements(
world, world->model,
- librdf_new_node_from_node(dmanifest),
- librdf_new_node_from_node(world->lv2_binary_node),
+ slv2_node_copy(dmanifest),
+ slv2_node_copy(world->lv2_binary_node),
NULL);
if (slv2_matches_end(binaries)) {
END_MATCH(binaries);
@@ -279,9 +279,8 @@ slv2_world_load_bundle(SLV2World world, SLV2Value bundle_uri)
continue;
}
- librdf_node* binary_node = librdf_new_node_from_node(MATCH_OBJECT(binaries));
-
- const uint8_t* lib_uri = librdf_uri_as_string(librdf_node_get_uri(binary_node));
+ librdf_node* binary = slv2_node_copy(MATCH_OBJECT(binaries));
+ const uint8_t* lib_uri = librdf_uri_as_string(librdf_node_get_uri(binary));
const char* lib_path = slv2_uri_to_path((const char*)lib_uri);
if (!lib_path)
continue;
@@ -320,8 +319,8 @@ slv2_world_load_bundle(SLV2World world, SLV2Value bundle_uri)
SLV2Matches dyn_plugins = slv2_world_find_statements(
world, dyn_manifest_model,
NULL,
- librdf_new_node_from_node(world->rdf_a_node),
- librdf_new_node_from_node(world->lv2_plugin_node));
+ slv2_node_copy(world->rdf_a_node),
+ slv2_node_copy(world->lv2_plugin_node));
FOREACH_MATCH(dyn_plugins) {
librdf_node* plugin = MATCH_SUBJECT(dyn_plugins);
@@ -329,7 +328,7 @@ slv2_world_load_bundle(SLV2World world, SLV2Value bundle_uri)
librdf_model_add(
manifest_model, plugin,
librdf_new_node_from_uri_string(world->world, SLV2_NS_RDFS "seeAlso"),
- librdf_new_node_from_node(binary_node));
+ slv2_node_copy(binary));
}
END_MATCH(dyn_plugins);
@@ -347,24 +346,24 @@ slv2_world_load_bundle(SLV2World world, SLV2Value bundle_uri)
SLV2Matches results = slv2_world_find_statements(
world, manifest_model,
NULL,
- librdf_new_node_from_node(world->rdf_a_node),
- librdf_new_node_from_node(world->lv2_plugin_node));
+ slv2_node_copy(world->rdf_a_node),
+ slv2_node_copy(world->lv2_plugin_node));
FOREACH_MATCH(results) {
librdf_node* plugin = MATCH_SUBJECT(results);
// Add ?plugin rdfs:seeAlso <manifest.ttl>
librdf_model_add(
world->model,
- librdf_new_node_from_node(plugin),
+ slv2_node_copy(plugin),
librdf_new_node_from_uri_string(world->world, SLV2_NS_RDFS "seeAlso"),
librdf_new_node_from_uri(world->world, manifest_uri));
// Add ?plugin slv2:bundleURI <file://some/path>
librdf_model_add(
world->model,
- librdf_new_node_from_node(plugin),
+ slv2_node_copy(plugin),
librdf_new_node_from_uri_string(world->world, SLV2_NS_SLV2 "bundleURI"),
- librdf_new_node_from_node(bundle_uri->val.uri_val));
+ slv2_node_copy(bundle_uri->val.uri_val));
}
END_MATCH(results);
@@ -372,24 +371,24 @@ slv2_world_load_bundle(SLV2World world, SLV2Value bundle_uri)
results = slv2_world_find_statements(
world, manifest_model,
NULL,
- librdf_new_node_from_node(world->rdf_a_node),
- librdf_new_node_from_node(world->lv2_specification_node));
+ slv2_node_copy(world->rdf_a_node),
+ slv2_node_copy(world->lv2_specification_node));
FOREACH_MATCH(results) {
librdf_node* spec = MATCH_SUBJECT(results);
// Add ?specification rdfs:seeAlso <manifest.ttl>
librdf_model_add(
world->model,
- librdf_new_node_from_node(spec),
+ slv2_node_copy(spec),
librdf_new_node_from_uri_string(world->world, SLV2_NS_RDFS "seeAlso"),
librdf_new_node_from_uri(world->world, manifest_uri));
// Add ?specification slv2:bundleURI <file://some/path>
librdf_model_add(
world->model,
- librdf_new_node_from_node(spec),
+ slv2_node_copy(spec),
librdf_new_node_from_uri_string(world->world, SLV2_NS_SLV2 "bundleURI"),
- librdf_new_node_from_node(bundle_uri->val.uri_val));
+ slv2_node_copy(bundle_uri->val.uri_val));
}
END_MATCH(results);
@@ -491,14 +490,14 @@ slv2_world_load_specifications(SLV2World world)
SLV2Matches specs = slv2_world_find_statements(
world, world->model,
NULL,
- librdf_new_node_from_node(world->rdf_a_node),
- librdf_new_node_from_node(world->lv2_specification_node));
+ slv2_node_copy(world->rdf_a_node),
+ slv2_node_copy(world->lv2_specification_node));
FOREACH_MATCH(specs) {
librdf_node* spec_node = MATCH_SUBJECT(specs);
SLV2Matches files = slv2_world_find_statements(
world, world->model,
- librdf_new_node_from_node(spec_node),
- librdf_new_node_from_node(world->rdfs_seealso_node),
+ slv2_node_copy(spec_node),
+ slv2_node_copy(world->rdfs_seealso_node),
NULL);
FOREACH_MATCH(files) {
librdf_node* file_node = MATCH_OBJECT(files);
@@ -522,16 +521,16 @@ slv2_world_load_plugin_classes(SLV2World world)
SLV2Matches classes = slv2_world_find_statements(
world, world->model,
NULL,
- librdf_new_node_from_node(world->rdf_a_node),
- librdf_new_node_from_node(world->rdfs_class_node));
+ slv2_node_copy(world->rdf_a_node),
+ slv2_node_copy(world->rdfs_class_node));
FOREACH_MATCH(classes) {
librdf_node* class_node = MATCH_SUBJECT(classes);
// Get parents (superclasses)
SLV2Matches parents = slv2_world_find_statements(
world, world->model,
- librdf_new_node_from_node(class_node),
- librdf_new_node_from_node(world->rdfs_subclassof_node),
+ slv2_node_copy(class_node),
+ slv2_node_copy(world->rdfs_subclassof_node),
NULL);
if (slv2_matches_end(parents)) {
@@ -539,7 +538,7 @@ slv2_world_load_plugin_classes(SLV2World world)
continue;
}
- librdf_node* parent_node = librdf_new_node_from_node(MATCH_OBJECT(parents));
+ librdf_node* parent_node = slv2_node_copy(MATCH_OBJECT(parents));
END_MATCH(parents);
if (!librdf_node_is_resource(parent_node)) {
@@ -550,8 +549,8 @@ slv2_world_load_plugin_classes(SLV2World world)
// Get labels
SLV2Matches labels = slv2_world_find_statements(
world, world->model,
- librdf_new_node_from_node(class_node),
- librdf_new_node_from_node(world->rdfs_label_node),
+ slv2_node_copy(class_node),
+ slv2_node_copy(world->rdfs_label_node),
NULL);
if (slv2_matches_end(labels)) {
@@ -559,7 +558,7 @@ slv2_world_load_plugin_classes(SLV2World world)
continue;
}
- librdf_node* label_node = librdf_new_node_from_node(MATCH_OBJECT(labels));
+ librdf_node* label_node = slv2_node_copy(MATCH_OBJECT(labels));
const uint8_t* label = librdf_node_get_literal_value(label_node);
librdf_free_stream(labels);
@@ -642,8 +641,8 @@ slv2_world_load_all(SLV2World world)
SLV2Matches plugins = slv2_world_find_statements(
world, world->model,
NULL,
- librdf_new_node_from_node(world->rdf_a_node),
- librdf_new_node_from_node(world->lv2_plugin_node));
+ slv2_node_copy(world->rdf_a_node),
+ slv2_node_copy(world->lv2_plugin_node));
FOREACH_MATCH(plugins) {
librdf_node* plugin_node = MATCH_SUBJECT(plugins);
const char* plugin_uri = (const char*)librdf_uri_as_string(
@@ -651,8 +650,8 @@ slv2_world_load_all(SLV2World world)
SLV2Matches bundles = slv2_world_find_statements(
world, world->model,
- librdf_new_node_from_node(plugin_node),
- librdf_new_node_from_node(world->slv2_bundleuri_node),
+ slv2_node_copy(plugin_node),
+ slv2_node_copy(world->slv2_bundleuri_node),
NULL);
if (slv2_matches_end(bundles)) {
@@ -661,7 +660,7 @@ slv2_world_load_all(SLV2World world)
continue;
}
- librdf_node* bundle_node = librdf_new_node_from_node(MATCH_OBJECT(bundles));
+ librdf_node* bundle_node = slv2_node_copy(MATCH_OBJECT(bundles));
slv2_matches_next(bundles);
if (!slv2_matches_end(bundles)) {
@@ -694,8 +693,8 @@ slv2_world_load_all(SLV2World world)
{
SLV2Matches dmanifests = slv2_world_find_statements(
world, world->model,
- librdf_new_node_from_node(plugin_node),
- librdf_new_node_from_node(world->slv2_dmanifest_node),
+ slv2_node_copy(plugin_node),
+ slv2_node_copy(world->slv2_dmanifest_node),
NULL);
FOREACH_MATCH(dmanifests) {
librdf_node* lib_node = MATCH_OBJECT(dmanifests);
@@ -711,8 +710,8 @@ slv2_world_load_all(SLV2World world)
#endif
SLV2Matches files = slv2_world_find_statements(
world, world->model,
- librdf_new_node_from_node(plugin_node),
- librdf_new_node_from_node(world->rdfs_seealso_node),
+ slv2_node_copy(plugin_node),
+ slv2_node_copy(world->rdfs_seealso_node),
NULL);
FOREACH_MATCH(files) {
librdf_node* file_node = MATCH_OBJECT(files);