summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-01-31 00:07:58 +0000
committerDavid Robillard <d@drobilla.net>2011-01-31 00:07:58 +0000
commita81b9cdaa2c8d6cf4fcef2472ac0dfa2ca7e47e9 (patch)
treead145f0ff98de10455f66533cf41bff9ccaeba69 /src
parent5201a6fe1cef5b322c7c9d3ab968199c29c7e8e3 (diff)
downloadlilv-a81b9cdaa2c8d6cf4fcef2472ac0dfa2ca7e47e9.tar.gz
lilv-a81b9cdaa2c8d6cf4fcef2472ac0dfa2ca7e47e9.tar.bz2
lilv-a81b9cdaa2c8d6cf4fcef2472ac0dfa2ca7e47e9.zip
Remove repetitive librdf node copy into slv2_plugin_get_unique.
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@2879 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/plugin.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/plugin.c b/src/plugin.c
index 4e2a630..d942106 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -137,7 +137,10 @@ slv2_plugin_query_node(SLV2Plugin p, librdf_node* subject, librdf_node* predicat
SLV2Value
slv2_plugin_get_unique(SLV2Plugin p, librdf_node* subject, librdf_node* predicate)
{
- SLV2Values values = slv2_plugin_query_node(p, subject, predicate);
+ SLV2Values values = slv2_plugin_query_node(
+ p,
+ librdf_new_node_from_node(subject),
+ librdf_new_node_from_node(predicate));
if (!values || slv2_values_size(values) != 1) {
SLV2_ERRORF("Port does not have exactly one `%s' property\n",
librdf_uri_as_string(librdf_node_get_uri(predicate)));
@@ -182,9 +185,7 @@ slv2_plugin_load_ports_if_necessary(SLV2Plugin p)
FOREACH_MATCH(ports) {
librdf_node* port = MATCH_OBJECT(ports);
SLV2Value symbol = slv2_plugin_get_unique(
- p,
- librdf_new_node_from_node(port),
- librdf_new_node_from_node(p->world->lv2_symbol_node));
+ p, port, p->world->lv2_symbol_node);
if (!slv2_value_is_string(symbol)) {
SLV2_ERROR("port has a non-string symbol\n");
@@ -193,9 +194,7 @@ slv2_plugin_load_ports_if_necessary(SLV2Plugin p)
}
SLV2Value index = slv2_plugin_get_unique(
- p,
- librdf_new_node_from_node(port),
- librdf_new_node_from_node(p->world->lv2_index_node));
+ p, port, p->world->lv2_index_node);
if (!slv2_value_is_int(index)) {
SLV2_ERROR("port has a non-integer index\n");
@@ -663,9 +662,8 @@ slv2_plugin_get_latency_port_index(SLV2Plugin p)
if (!slv2_matches_end(reports_latency)) {
SLV2Value index = slv2_plugin_get_unique(
- p,
- librdf_new_node_from_node(port),
- librdf_new_node_from_node(p->world->lv2_index_node));
+ p, port, p->world->lv2_index_node);
+
ret = slv2_value_as_int(index);
slv2_value_free(index);
break;
@@ -829,14 +827,15 @@ slv2_plugin_get_uis(SLV2Plugin p)
librdf_node* ui = MATCH_OBJECT(uis);
SLV2Value type = slv2_plugin_get_unique(
- p,
- librdf_new_node_from_node(ui),
- librdf_new_node_from_node(p->world->rdf_a_node));
+ p, ui, p->world->rdf_a_node);
+
+ librdf_node* ui_binary_node = librdf_new_node_from_uri_string(
+ p->world->world, NS_UI "binary");
SLV2Value binary = slv2_plugin_get_unique(
- p,
- librdf_new_node_from_node(ui),
- librdf_new_node_from_uri_string(p->world->world, NS_UI "binary"));
+ p, ui, ui_binary_node);
+
+ librdf_free_node(ui_binary_node);
if (!librdf_node_is_resource(ui)
|| !slv2_value_is_uri(type)