summaryrefslogtreecommitdiffstats
path: root/src/port.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-02-11 05:15:56 +0000
committerDavid Robillard <d@drobilla.net>2011-02-11 05:15:56 +0000
commit9749ab338c735f777be4fe6dc89082ea30044df1 (patch)
tree556314b7eb9d0472d06a78b003c56e820d6dd288 /src/port.c
parent28d3d1608126a676ea1d08249bac167bd5e88035 (diff)
downloadlilv-9749ab338c735f777be4fe6dc89082ea30044df1.tar.gz
lilv-9749ab338c735f777be4fe6dc89082ea30044df1.tar.bz2
lilv-9749ab338c735f777be4fe6dc89082ea30044df1.zip
Reduce internal use of _by_qname variants (unnecessary overhead).
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@2918 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/port.c')
-rw-r--r--src/port.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/port.c b/src/port.c
index 2ee3337..615d38f 100644
--- a/src/port.c
+++ b/src/port.c
@@ -199,19 +199,21 @@ SLV2Value
slv2_port_get_name(SLV2Plugin p,
SLV2Port port)
{
- SLV2Value ret = NULL;
- SLV2Values results = slv2_port_get_value_by_qname(p, port, "lv2:name");
-
- if (results && slv2_values_size(results) > 0) {
- ret = slv2_value_duplicate(slv2_values_get_at(results, 0));
- } else {
- results = slv2_port_get_value_by_qname(p, port, "lv2:name");
- if (results && slv2_values_size(results) > 0)
- ret = slv2_value_duplicate(slv2_values_get_at(results, 0));
+ SLV2Values results = slv2_port_get_value(p, port,
+ p->world->lv2_name_val);
+
+ SLV2Value ret = NULL;
+ if (results) {
+ SLV2Value val = slv2_values_get_at(results, 0);
+ if (slv2_value_is_string(val))
+ ret = slv2_value_duplicate(val);
+ slv2_values_free(results);
}
- slv2_values_free(results);
-
+ if (!ret)
+ SLV2_WARNF("<%s> has no (mandatory) doap:name\n",
+ slv2_value_as_string(slv2_plugin_get_uri(p)));
+
return ret;
}
@@ -301,6 +303,10 @@ SLV2Values
slv2_port_get_properties(SLV2Plugin p,
SLV2Port port)
{
- return slv2_port_get_value_by_qname(p, port, "lv2:portProperty");
+ SLV2Value pred = slv2_value_new_from_node(
+ p->world, p->world->lv2_portproperty_node);
+ SLV2Values ret = slv2_port_get_value(p, port, pred);
+ slv2_value_free(pred);
+ return ret;
}