summaryrefslogtreecommitdiffstats
path: root/controller/ctl-plugin.c
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-09-18 08:19:54 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-12-14 11:00:25 +0100
commitab89b4a133946980adc34b86858bebc0dcc7c713 (patch)
tree1eecbfaded45e210fd2cba04e6e3b6999331208e /controller/ctl-plugin.c
parent12097251ec058b1fa9d9202998c829b27ee5554f (diff)
Good way to iterate over defined plugins
Change-Id: Ifa3b14ea0f8bcd97347f4e5e6b99ef79f5b27dd4 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'controller/ctl-plugin.c')
-rw-r--r--controller/ctl-plugin.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/controller/ctl-plugin.c b/controller/ctl-plugin.c
index 69f0f09..d982b79 100644
--- a/controller/ctl-plugin.c
+++ b/controller/ctl-plugin.c
@@ -35,7 +35,7 @@ typedef void *Lua2cWrapperT;
#include "ctl-config.h"
-static CtlPluginT *ctlPlugins=NULL;
+static CtlPluginT *ctlPlugins=NULL;
int PluginGetCB (CtlActionT *action , json_object *callbackJ) {
const char *plugin=NULL, *function=NULL;
@@ -221,12 +221,12 @@ int PluginConfig(CtlSectionT *section, json_object *pluginsJ) {
if (ctlPlugins)
{
- int pluginsCount = (sizeof(ctlPlugins) / sizeof(CtlPluginT)) + 1;
- for(int idx = 0; idx < pluginsCount; idx++)
+ int idx = 0;
+ while(ctlPlugins[idx].label != NULL)
{
// Jose hack to make verbosity visible from sharedlib and
// be able to call verb from others api inside the binder
- struct afb_binding_data_v2 *afbHidenData = dlsym(ctlPlugins[idx].dlHandle, "afbBindingV2data");
+ struct afb_binding_data_v2 *afbHidenData = dlsym(ctlPlugins[idx++].dlHandle, "afbBindingV2data");
if (afbHidenData) *afbHidenData = afbBindingV2data;
}
return 0;