summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-02-22 04:00:05 +0000
committerDavid Robillard <d@drobilla.net>2011-02-22 04:00:05 +0000
commitfc28ae6099ed8d352c4e05882c090ef08d2df1a9 (patch)
tree08e40e1ff3020343850de488afb5aa816b59e920
parent51ef7905c4d8dd143c498bb0c088035d930742bc (diff)
downloadlilv-fc28ae6099ed8d352c4e05882c090ef08d2df1a9.tar.gz
lilv-fc28ae6099ed8d352c4e05882c090ef08d2df1a9.tar.bz2
lilv-fc28ae6099ed8d352c4e05882c090ef08d2df1a9.zip
Tidy.
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@3002 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/pluginuiinstance.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/pluginuiinstance.c b/src/pluginuiinstance.c
index 908d746..3f1017a 100644
--- a/src/pluginuiinstance.c
+++ b/src/pluginuiinstance.c
@@ -38,7 +38,7 @@ slv2_ui_instantiate(SLV2Plugin plugin,
{
struct _SLV2UIInstance* result = NULL;
- bool local_features = (features == NULL);
+ const bool local_features = (features == NULL);
if (local_features) {
features = malloc(sizeof(LV2_Feature));
((LV2_Feature**)features)[0] = NULL;
@@ -46,9 +46,9 @@ slv2_ui_instantiate(SLV2Plugin plugin,
const char* const lib_uri = slv2_value_as_string(slv2_ui_get_binary_uri(ui));
const char* const lib_path = slv2_uri_to_path(lib_uri);
-
- if (!lib_path)
+ if (!lib_path) {
return NULL;
+ }
dlerror();
void* lib = dlopen(lib_path, RTLD_NOW);
@@ -66,8 +66,8 @@ slv2_ui_instantiate(SLV2Plugin plugin,
dlclose(lib);
return NULL;
} else {
-
- const char* bundle_path = slv2_uri_to_path(slv2_value_as_uri(slv2_ui_get_bundle_uri(ui)));
+ const char* bundle_uri = slv2_value_as_uri(slv2_ui_get_bundle_uri(ui));
+ const char* bundle_path = slv2_uri_to_path(bundle_uri);
for (uint32_t i = 0; true; ++i) {
const LV2UI_Descriptor* ld = df(i);
@@ -83,13 +83,14 @@ slv2_ui_instantiate(SLV2Plugin plugin,
// Create SLV2UIInstance to return
result = malloc(sizeof(struct _SLV2UIInstance));
result->lv2ui_descriptor = ld;
- result->lv2ui_handle = ld->instantiate(ld,
- slv2_value_as_uri(slv2_plugin_get_uri(plugin)),
- (char*)bundle_path,
- write_function,
- controller,
- &result->widget,
- features);
+ result->lv2ui_handle = ld->instantiate(
+ ld,
+ slv2_value_as_uri(slv2_plugin_get_uri(plugin)),
+ (char*)bundle_path,
+ write_function,
+ controller,
+ &result->widget,
+ features);
result->lib_handle = lib;
break;
}
@@ -102,15 +103,15 @@ slv2_ui_instantiate(SLV2Plugin plugin,
return NULL;
}
- // Failed to create a widget, but still got a handle - this means that
- // the plugin is buggy
+ // Failed to create a widget, but still got a handle (buggy UI)
if (result->widget == NULL) {
slv2_ui_instance_free(result);
return NULL;
}
- if (local_features)
+ if (local_features) {
free((LV2_Feature**)features);
+ }
return result;
}