From f7963514ecc6b09717e5a5b49845cb0043145e37 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 23 Nov 2012 02:36:26 +0000 Subject: Factor out common "ask if a triple is present" pattern. git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@4856 a436a847-0d15-0410-975c-d299462d15a1 --- src/port.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'src/port.c') 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 -- cgit v1.2.1