summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--src/lilv_internal.h6
-rw-r--r--src/plugin.c15
-rw-r--r--src/port.c20
-rw-r--r--src/world.c9
5 files changed, 22 insertions, 30 deletions
diff --git a/NEWS b/NEWS
index d90f795..7697925 100644
--- a/NEWS
+++ b/NEWS
@@ -3,7 +3,7 @@ lilv (0.14.5) unstable;
* Disable timestamps in HTML documentation for reproducible build
* Correctly depend on serd at build time (fix compilation in odd cases)
- -- David Robillard <d@drobilla.net> Sun, 09 Sep 2012 03:19:01 -0400
+ -- David Robillard <d@drobilla.net> Thu, 22 Nov 2012 21:35:53 -0500
lilv (0.14.4) stable;
diff --git a/src/lilv_internal.h b/src/lilv_internal.h
index f23b7a2..60dae6a 100644
--- a/src/lilv_internal.h
+++ b/src/lilv_internal.h
@@ -310,6 +310,12 @@ lilv_world_query_internal(LilvWorld* world,
const SordNode* predicate,
const SordNode* object);
+bool
+lilv_world_ask_internal(LilvWorld* world,
+ const SordNode* subject,
+ const SordNode* predicate,
+ const SordNode* object);
+
LilvNodes*
lilv_world_query_values_internal(LilvWorld* world,
const SordNode* subject,
diff --git a/src/plugin.c b/src/plugin.c
index 758790b..4decba7 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -719,18 +719,11 @@ lilv_plugin_has_extension_data(const LilvPlugin* p,
return false;
}
- SordIter* iter = lilv_world_query_internal(
+ return lilv_world_ask_internal(
p->world,
p->plugin_uri->node,
p->world->uris.lv2_extensionData,
uri->node);
-
- if (iter) {
- sord_iter_free(iter);
- return true;
- } else {
- return false;
- }
}
LILV_API
@@ -951,14 +944,12 @@ lilv_plugin_get_related(const LilvPlugin* plugin, const LilvNode* type)
LilvNodes* matches = lilv_nodes_new();
LILV_FOREACH(nodes, i, related) {
LilvNode* node = (LilvNode*)lilv_collection_get((ZixTree*)related, i);
- SordIter* titer = lilv_world_query_internal(
- world, node->node, world->uris.rdf_a, type->node);
- if (!sord_iter_end(titer)) {
+ if (lilv_world_ask_internal(
+ world, node->node, world->uris.rdf_a, type->node)) {
zix_tree_insert((ZixTree*)matches,
lilv_node_new_from_node(world, node->node),
NULL);
}
- sord_iter_free(titer);
}
lilv_nodes_free(related);
diff --git a/src/port.c b/src/port.c
index 43e5708..782ca60 100644
--- a/src/port.c
+++ b/src/port.c
@@ -68,16 +68,11 @@ lilv_port_has_property(const LilvPlugin* p,
const LilvPort* port,
const LilvNode* property)
{
- assert(property);
- SordIter* results = lilv_world_query_internal(
+ return lilv_world_ask_internal(
p->world,
port->node,
p->world->uris.lv2_portProperty,
lilv_node_as_node(property));
-
- const bool ret = !sord_iter_end(results);
- sord_iter_free(results);
- return ret;
}
LILV_API
@@ -86,16 +81,11 @@ lilv_port_supports_event(const LilvPlugin* p,
const LilvPort* port,
const LilvNode* event)
{
- assert(event);
- SordIter* results = lilv_world_query_internal(
+ return lilv_world_ask_internal(
p->world,
port->node,
sord_new_uri(p->world->world, (const uint8_t*)LV2_EVENT__supportsEvent),
lilv_node_as_node(event));
-
- const bool ret = !sord_iter_end(results);
- sord_iter_free(results);
- return ret;
}
static LilvNodes*
@@ -103,15 +93,11 @@ lilv_port_get_value_by_node(const LilvPlugin* p,
const LilvPort* port,
const SordNode* predicate)
{
- assert(sord_node_get_type(predicate) == SORD_URI);
-
- SordIter* results = lilv_world_query_internal(
+ return lilv_world_query_values_internal(
p->world,
port->node,
predicate,
NULL);
-
- return lilv_nodes_from_stream_objects(p->world, results, SORD_OBJECT);
}
LILV_API
diff --git a/src/world.c b/src/world.c
index b34cf3c..afa3422 100644
--- a/src/world.c
+++ b/src/world.c
@@ -221,6 +221,15 @@ lilv_world_query_internal(LilvWorld* world,
return sord_search(world->model, subject, predicate, object, NULL);
}
+bool
+lilv_world_ask_internal(LilvWorld* world,
+ const SordNode* subject,
+ const SordNode* predicate,
+ const SordNode* object)
+{
+ return sord_ask(world->model, subject, predicate, object, NULL);
+}
+
LilvNodes*
lilv_world_query_values_internal(LilvWorld* world,
const SordNode* subject,