summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-11-29 01:38:16 +0000
committerDavid Robillard <d@drobilla.net>2007-11-29 01:38:16 +0000
commit4ea3b91218fb9e08ef32446fdde838dab142d9d6 (patch)
tree9766aff3410b64ca19b0a6cec7c8d94c7a47cb5e
parent8fe04afd500698a791ed1d734bd6553fe557ca10 (diff)
downloadlilv-4ea3b91218fb9e08ef32446fdde838dab142d9d6.tar.gz
lilv-4ea3b91218fb9e08ef32446fdde838dab142d9d6.tar.bz2
lilv-4ea3b91218fb9e08ef32446fdde838dab142d9d6.zip
Fix instantiate parameters to match lv2.h
git-svn-id: http://svn.drobilla.net/lad/slv2@921 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--slv2/plugininstance.h6
-rw-r--r--src/plugininstance.c22
2 files changed, 14 insertions, 14 deletions
diff --git a/slv2/plugininstance.h b/slv2/plugininstance.h
index 982f536..a78b644 100644
--- a/slv2/plugininstance.h
+++ b/slv2/plugininstance.h
@@ -72,9 +72,9 @@ typedef struct _Instance {
* \return NULL if instantiation failed.
*/
SLV2Instance
-slv2_plugin_instantiate(SLV2Plugin plugin,
- double sample_rate,
- const LV2_Feature** features);
+slv2_plugin_instantiate(SLV2Plugin plugin,
+ double sample_rate,
+ const LV2_Feature*const* features);
/** Free a plugin instance.
diff --git a/src/plugininstance.c b/src/plugininstance.c
index 4e405a7..55d1225 100644
--- a/src/plugininstance.c
+++ b/src/plugininstance.c
@@ -31,16 +31,16 @@
SLV2Instance
-slv2_plugin_instantiate(SLV2Plugin plugin,
- double sample_rate,
- const LV2_Feature** features)
+slv2_plugin_instantiate(SLV2Plugin plugin,
+ double sample_rate,
+ const LV2_Feature*const* features)
{
struct _Instance* result = NULL;
- bool local_features = (features == NULL);
- if (local_features) {
- features = malloc(sizeof(LV2_Feature));
- features[0] = NULL;
+ const LV2_Feature** local_features = NULL;
+ if (features == NULL) {
+ local_features = malloc(sizeof(LV2_Feature));
+ local_features[0] = NULL;
}
const char* const lib_uri = slv2_plugin_get_library_uri(plugin);
@@ -91,8 +91,9 @@ slv2_plugin_instantiate(SLV2Plugin plugin,
// Create SLV2Instance to return
result = malloc(sizeof(struct _Instance));
result->lv2_descriptor = ld;
- result->lv2_handle = ld->instantiate(ld, sample_rate, (char*)bundle_path, features);
- struct _InstanceImpl* impl = malloc(sizeof(struct _InstanceImpl));
+ result->lv2_handle = ld->instantiate(ld, sample_rate, (char*)bundle_path,
+ (features) ? features : local_features);
+ struct _InstanceImpl* impl = malloc(sizeof(struct _InstanceImpl));
impl->lib_handle = lib;
result->pimpl = impl;
@@ -116,8 +117,7 @@ slv2_plugin_instantiate(SLV2Plugin plugin,
result->lv2_descriptor->connect_port(result->lv2_handle, i, NULL);
}
- if (local_features)
- free(features);
+ free(local_features);
return result;
}