diff options
author | David Robillard <d@drobilla.net> | 2012-08-02 22:12:06 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-08-02 22:12:06 +0000 |
commit | 0bb37e7451f42fe82b28145455a71c56c92174b8 (patch) | |
tree | ade81993e9add2e2fdb64555af7a53a437386a79 /src/instance.c | |
parent | 2f49d76d50c658eabd765245b51332924cd62147 (diff) | |
download | suil-0bb37e7451f42fe82b28145455a71c56c92174b8.tar.gz suil-0bb37e7451f42fe82b28145455a71c56c92174b8.tar.bz2 suil-0bb37e7451f42fe82b28145455a71c56c92174b8.zip |
Replace host provided features that match Suil implemented features, rather
than passing UIs duplicate features.
git-svn-id: http://svn.drobilla.net/lad/trunk/suil@4599 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/instance.c')
-rw-r--r-- | src/instance.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/instance.c b/src/instance.c index ca15ffe..5b53328 100644 --- a/src/instance.c +++ b/src/instance.c @@ -193,30 +193,31 @@ suil_instance_new(SuilHost* host, instance->features[0] = NULL; // Copy user provided features - unsigned n_features = 0; - for (; features && features[n_features]; ++n_features) { - const LV2_Feature* f = features[n_features]; - suil_add_feature(&instance->features, n_features, f->URI, f->data); + const LV2_Feature* const* fi = features; + unsigned n_features = 0; + while (fi && *fi) { + const LV2_Feature* f = *fi++; + suil_add_feature(&instance->features, &n_features, f->URI, f->data); } // Add additional features implemented by SuilHost functions if (host->index_func) { instance->port_map.handle = controller; instance->port_map.port_index = host->index_func; - suil_add_feature(&instance->features, n_features++, + suil_add_feature(&instance->features, &n_features, LV2_UI__portMap, &instance->port_map); } if (host->subscribe_func && host->unsubscribe_func) { instance->port_subscribe.handle = controller; instance->port_subscribe.subscribe = host->subscribe_func; instance->port_subscribe.unsubscribe = host->unsubscribe_func; - suil_add_feature(&instance->features, n_features++, + suil_add_feature(&instance->features, &n_features, LV2_UI__portSubscribe, &instance->port_subscribe); } if (host->touch_func) { instance->touch.handle = controller; instance->touch.touch = host->touch_func; - suil_add_feature(&instance->features, n_features++, + suil_add_feature(&instance->features, &n_features, LV2_UI__touch, &instance->touch); } |