summaryrefslogtreecommitdiffstats
path: root/src/instance.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-09-29 01:14:00 +0000
committerDavid Robillard <d@drobilla.net>2011-09-29 01:14:00 +0000
commit9fe0099b416b78b6b883b8a2422842f44d954f1d (patch)
tree1689f3a5abe204752385eec0ab61c40cab22cd72 /src/instance.c
parent70610a9cc403148e248fa2300fd7c0757f86a339 (diff)
downloadlilv-9fe0099b416b78b6b883b8a2422842f44d954f1d.tar.gz
lilv-9fe0099b416b78b6b883b8a2422842f44d954f1d.tar.bz2
lilv-9fe0099b416b78b6b883b8a2422842f44d954f1d.zip
Tidy.
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@3507 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/instance.c')
-rw-r--r--src/instance.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/src/instance.c b/src/instance.c
index c3dcb00..b12a7d3 100644
--- a/src/instance.c
+++ b/src/instance.c
@@ -72,40 +72,40 @@ lilv_plugin_instantiate(const LilvPlugin* plugin,
lib_path);
dlclose(lib);
break; // return NULL
+ }
+
+ // Parse bundle URI to use as base URI
+ const LilvNode* bundle_uri = lilv_plugin_get_bundle_uri(plugin);
+ const char* bundle_uri_str = lilv_node_as_uri(bundle_uri);
+ SerdURI base_uri;
+ if (serd_uri_parse((const uint8_t*)bundle_uri_str, &base_uri)) {
+ dlclose(lib);
+ break;
+ }
+
+ // Resolve library plugin URI against base URI
+ SerdURI abs_uri;
+ SerdNode abs_uri_node = serd_node_new_uri_from_string(
+ (const uint8_t*)ld->URI, &base_uri, &abs_uri);
+ if (!abs_uri_node.buf) {
+ LILV_ERRORF("Failed to parse plugin URI `%s'\n", ld->URI);
+ dlclose(lib);
+ break;
+ }
+
+ if (!strcmp((const char*)abs_uri_node.buf,
+ lilv_node_as_uri(lilv_plugin_get_uri(plugin)))) {
+ // Create LilvInstance to return
+ result = malloc(sizeof(struct LilvInstanceImpl));
+ result->lv2_descriptor = ld;
+ result->lv2_handle = ld->instantiate(
+ ld, sample_rate, (char*)bundle_path,
+ (features) ? features : local_features);
+ result->pimpl = lib;
+ serd_node_free(&abs_uri_node);
+ break;
} else {
- // Parse bundle URI to use as base URI
- const LilvNode* bundle_uri = lilv_plugin_get_bundle_uri(plugin);
- const char* bundle_uri_str = lilv_node_as_uri(bundle_uri);
- SerdURI base_uri;
- if (serd_uri_parse((const uint8_t*)bundle_uri_str, &base_uri)) {
- dlclose(lib);
- break;
- }
-
- // Resolve library plugin URI against base URI
- SerdURI abs_uri;
- SerdNode abs_uri_node = serd_node_new_uri_from_string(
- (const uint8_t*)ld->URI, &base_uri, &abs_uri);
- if (!abs_uri_node.buf) {
- LILV_ERRORF("Failed to parse plugin URI `%s'\n", ld->URI);
- dlclose(lib);
- break;
- }
-
- if (!strcmp((const char*)abs_uri_node.buf,
- lilv_node_as_uri(lilv_plugin_get_uri(plugin)))) {
- // Create LilvInstance to return
- result = malloc(sizeof(struct LilvInstanceImpl));
- result->lv2_descriptor = ld;
- result->lv2_handle = ld->instantiate(
- ld, sample_rate, (char*)bundle_path,
- (features) ? features : local_features);
- result->pimpl = lib;
- serd_node_free(&abs_uri_node);
- break;
- } else {
- serd_node_free(&abs_uri_node);
- }
+ serd_node_free(&abs_uri_node);
}
}
}