summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-01-30 23:01:41 +0000
committerDavid Robillard <d@drobilla.net>2011-01-30 23:01:41 +0000
commit41164a763cdc9270dadcf45549c715ce90a47ed5 (patch)
treedfd23683823e626dabadf56c6e7805628c4d124c /src
parentd136e0bbd0f0d30a1a6d519462f4ad7bee4812b1 (diff)
downloadlilv-41164a763cdc9270dadcf45549c715ce90a47ed5.tar.gz
lilv-41164a763cdc9270dadcf45549c715ce90a47ed5.tar.bz2
lilv-41164a763cdc9270dadcf45549c715ce90a47ed5.zip
Make slv2_ui_new take SLV2Value URI arguments rather than librdf_uri.
Avoids an unnecessary node copy, UI takes ownership of queried nodes. git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@2877 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/plugin.c14
-rw-r--r--src/pluginui.c20
-rw-r--r--src/slv2_internal.h8
3 files changed, 20 insertions, 22 deletions
diff --git a/src/plugin.c b/src/plugin.c
index 9f3248b..43eb0f8 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -841,19 +841,19 @@ slv2_plugin_get_uis(SLV2Plugin p)
if (!librdf_node_is_resource(ui)
|| !slv2_value_is_uri(type)
|| !slv2_value_is_uri(binary)) {
+ slv2_value_free(binary);
+ slv2_value_free(type);
SLV2_ERROR("Corrupt UI\n");
continue;
}
- SLV2UI slv2_ui = slv2_ui_new(p->world,
- librdf_node_get_uri(ui),
- slv2_value_as_librdf_uri(type),
- slv2_value_as_librdf_uri(binary));
+ SLV2UI slv2_ui = slv2_ui_new(
+ p->world,
+ slv2_value_new_librdf_uri(p->world, librdf_node_get_uri(ui)),
+ type,
+ binary);
raptor_sequence_push(result, slv2_ui);
-
- slv2_value_free(binary);
- slv2_value_free(type);
}
END_MATCH(uis);
diff --git a/src/pluginui.c b/src/pluginui.c
index 8c6b0f3..7cbf475 100644
--- a/src/pluginui.c
+++ b/src/pluginui.c
@@ -29,31 +29,29 @@
/* private */
SLV2UI
-slv2_ui_new(SLV2World world,
- librdf_uri* uri,
- librdf_uri* type_uri,
- librdf_uri* binary_uri)
+slv2_ui_new(SLV2World world,
+ SLV2Value uri,
+ SLV2Value type_uri,
+ SLV2Value binary_uri)
{
assert(uri);
assert(type_uri);
assert(binary_uri);
struct _SLV2UI* ui = malloc(sizeof(struct _SLV2UI));
- ui->world = world;
- ui->uri = slv2_value_new_librdf_uri(world, uri);
- ui->binary_uri = slv2_value_new_librdf_uri(world, binary_uri);
-
- assert(ui->binary_uri);
+ ui->world = world;
+ ui->uri = uri;
+ ui->binary_uri = binary_uri;
// FIXME: kludge
- char* bundle = strdup(slv2_value_as_string(ui->binary_uri));
+ char* bundle = strdup(slv2_value_as_string(ui->binary_uri));
char* last_slash = strrchr(bundle, '/') + 1;
*last_slash = '\0';
ui->bundle_uri = slv2_value_new_uri(world, bundle);
free(bundle);
ui->classes = slv2_values_new();
- raptor_sequence_push(ui->classes, slv2_value_new_librdf_uri(world, type_uri));
+ raptor_sequence_push(ui->classes, type_uri);
return ui;
}
diff --git a/src/slv2_internal.h b/src/slv2_internal.h
index 2d161cb..e014346 100644
--- a/src/slv2_internal.h
+++ b/src/slv2_internal.h
@@ -221,10 +221,10 @@ struct _SLV2UI {
SLV2UIs slv2_uis_new();
SLV2UI
-slv2_ui_new(SLV2World world,
- librdf_uri* uri,
- librdf_uri* type_uri,
- librdf_uri* binary_uri);
+slv2_ui_new(SLV2World world,
+ SLV2Value uri,
+ SLV2Value type_uri,
+ SLV2Value binary_uri);
void slv2_ui_free(SLV2UI ui);