summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ctl-lib/ctl-config.c10
-rw-r--r--ctl-lib/ctl-config.h8
-rw-r--r--ctl-lib/ctl-lua.c2
-rw-r--r--ctl-lib/ctl-lua.h2
-rw-r--r--ctl-lib/ctl-plugin.c4
5 files changed, 11 insertions, 15 deletions
diff --git a/ctl-lib/ctl-config.c b/ctl-lib/ctl-config.c
index e6a16b9..6b8b9be 100644
--- a/ctl-lib/ctl-config.c
+++ b/ctl-lib/ctl-config.c
@@ -173,7 +173,7 @@ int CtlConfigExec(afb_api_t apiHandle, CtlConfigT *ctlConfig) {
return 0;
}
-CtlConfigT *CtlLoadMetaDataJson(afb_api_t apiHandle, json_object *ctlConfigJ, const char *prefix) {
+CtlConfigT *CtlLoadMetaDataJson(afb_api_t apiHandle, json_object *ctlConfigJ) {
json_object *metadataJ;
CtlConfigT *ctlHandle=NULL;
@@ -193,13 +193,12 @@ CtlConfigT *CtlLoadMetaDataJson(afb_api_t apiHandle, json_object *ctlConfigJ, co
return NULL;
}
ctlHandle->configJ = ctlConfigJ;
- ctlHandle->prefix = prefix;
}
return ctlHandle;
}
-CtlConfigT *CtlLoadMetaDataUsingPrefix(afb_api_t apiHandle,const char* filepath, const char *prefix) {
+CtlConfigT *CtlLoadMetaData(afb_api_t apiHandle,const char* filepath) {
json_object *ctlConfigJ;
@@ -212,7 +211,7 @@ CtlConfigT *CtlLoadMetaDataUsingPrefix(afb_api_t apiHandle,const char* filepath,
AFB_API_INFO(apiHandle, "CTL-LOAD-CONFIG: loading config filepath=%s", filepath);
- return CtlLoadMetaDataJson(apiHandle, ctlConfigJ, prefix);
+ return CtlLoadMetaDataJson(apiHandle, ctlConfigJ);
}
void wrap_json_array_add(void* array, json_object *val) {
@@ -317,7 +316,7 @@ int CtlLoadSections(afb_api_t apiHandle, CtlConfigT *ctlHandle, CtlSectionT *sec
int error;
#ifdef CONTROL_SUPPORT_LUA
- if (LuaConfigLoad(apiHandle, ctlHandle->prefix))
+ if (LuaConfigLoad(apiHandle))
return -1;
#endif
@@ -325,7 +324,6 @@ int CtlLoadSections(afb_api_t apiHandle, CtlConfigT *ctlHandle, CtlSectionT *sec
for (int idx = 0; sections[idx].key != NULL; idx++) {
json_object * sectionJ;
if (json_object_object_get_ex(ctlHandle->configJ, sections[idx].key, &sectionJ)) {
- sections[idx].prefix = ctlHandle->prefix;
json_object* updatedSectionJ = LoadAdditionalsFiles(apiHandle, ctlHandle, sections[idx].key, sectionJ);
if (!sections[idx].loadCB) {
diff --git a/ctl-lib/ctl-config.h b/ctl-lib/ctl-config.h
index 53a75f4..928c30f 100644
--- a/ctl-lib/ctl-config.h
+++ b/ctl-lib/ctl-config.h
@@ -59,7 +59,6 @@ typedef struct ConfigSectionS {
const char *key;
const char *uid;
const char *info;
- const char *prefix;
int (*loadCB)(afb_api_t apihandle, struct ConfigSectionS *section, json_object *sectionJ);
void *handle;
CtlActionT *actions;
@@ -72,7 +71,6 @@ typedef struct {
const char *version;
const char *author;
const char *date;
- const char *prefix;
json_object *configJ;
json_object *requireJ;
CtlSectionT *sections;
@@ -108,11 +106,11 @@ extern char* ConfigSearch(afb_api_t apiHandle, json_object *responseJ);
extern char* CtlConfigSearch(afb_api_t apiHandle, const char *dirList, const char *prefix) ;
extern void DispatchRequireApi(afb_api_t apiHandle, json_object * requireJ);
extern int CtlConfigExec(afb_api_t apiHandle, CtlConfigT *ctlConfig) ;
-extern CtlConfigT *CtlLoadMetaDataJson(afb_api_t apiHandle,json_object *ctlConfigJ, const char *prefix) ;
-extern CtlConfigT *CtlLoadMetaDataUsingPrefix(afb_api_t apiHandle,const char* filepath, const char *prefix) ;
+extern CtlConfigT *CtlLoadMetaDataJson(afb_api_t apiHandle,json_object *ctlConfigJ);
+extern CtlConfigT *CtlLoadMetaData(afb_api_t apiHandle,const char* filepath);
extern int CtlLoadSections(afb_api_t apiHandle, CtlConfigT *ctlHandle, CtlSectionT *sections);
extern char *GetDefaultConfigSearchPath(afb_api_t apiHandle);
-#define CtlLoadMetaData(api, filepath) CtlLoadMetaDataUsingPrefix(api, filepath, NULL)
+#define CtlLoadMetaDataUsingPrefix(apiHandle, filepath, prefix) CtlLoadMetaData(apiHandle, filepath)
// ctl-event.c
extern int EventConfig(afb_api_t apihandle, CtlSectionT *section, json_object *actionsJ);
diff --git a/ctl-lib/ctl-lua.c b/ctl-lib/ctl-lua.c
index f3f0dce..4024cf9 100644
--- a/ctl-lib/ctl-lua.c
+++ b/ctl-lib/ctl-lua.c
@@ -1350,7 +1350,7 @@ int LuaConfigExec(afb_api_t apiHandle) {
// Load Lua Interpreter
-int LuaConfigLoad(afb_api_t apiHandle, const char *prefix) {
+int LuaConfigLoad(afb_api_t apiHandle) {
size_t total_len = 0, base_len = 0, spath_len = 0;
static int luaLoaded = 0;
int token_nb = 0, i = 0;
diff --git a/ctl-lib/ctl-lua.h b/ctl-lib/ctl-lua.h
index 5107108..a1b649b 100644
--- a/ctl-lib/ctl-lua.h
+++ b/ctl-lib/ctl-lua.h
@@ -53,7 +53,7 @@ typedef enum {
extern const char *lua_utils;
extern int LuaLoadScript(afb_api_t apiHandle, const char *luaScriptPath);
-extern int LuaConfigLoad (afb_api_t apiHandle, const char *prefix);
+extern int LuaConfigLoad (afb_api_t apiHandle);
extern void LuaL2cNewLib(luaL_Reg *l2cFunc, int count, const char *prefix);
extern int Lua2cWrapper(void* luaHandle, char *funcname, Lua2cFunctionT callback);
extern int LuaCallFunc (CtlSourceT *source, CtlActionT *action, json_object *queryJ) ;
diff --git a/ctl-lib/ctl-plugin.c b/ctl-lib/ctl-plugin.c
index 6a446c9..417381c 100644
--- a/ctl-lib/ctl-plugin.c
+++ b/ctl-lib/ctl-plugin.c
@@ -553,7 +553,7 @@ static int FindPlugins(afb_api_t apiHandle, const char *searchPath, const char *
return 0;
}
-static int PluginLoad (afb_api_t apiHandle, CtlPluginT *ctlPlugin, json_object *pluginJ, void *handle, const char *prefix)
+static int PluginLoad (afb_api_t apiHandle, CtlPluginT *ctlPlugin, json_object *pluginJ, void *handle)
{
int err = 0, i = 0;
char *searchPath = NULL;
@@ -672,7 +672,7 @@ static int PluginParse(afb_api_t apiHandle, CtlSectionT *section, json_object *p
while(idx < totalPluginNumber) {
json_object *pluginJ = json_object_is_type(pluginsJ, json_type_array) ?
json_object_array_get_idx(pluginsJ, idx) : pluginsJ;
- err += PluginLoad(apiHandle, &ctlPluginsNew[idx], pluginJ, section->handle, section->prefix);
+ err += PluginLoad(apiHandle, &ctlPluginsNew[idx], pluginJ, section->handle);
idx++;
}