aboutsummaryrefslogtreecommitdiffstats
path: root/controller
diff options
context:
space:
mode:
Diffstat (limited to 'controller')
-rw-r--r--controller/ctl-lua.c4
-rw-r--r--controller/ctl-lua.h10
-rw-r--r--controller/ctl-plugin.c3
3 files changed, 8 insertions, 9 deletions
diff --git a/controller/ctl-lua.c b/controller/ctl-lua.c
index 518ff85..f694e58 100644
--- a/controller/ctl-lua.c
+++ b/controller/ctl-lua.c
@@ -610,9 +610,9 @@ STATIC int LuaAfbEventMake(lua_State* luaState) {
}
// Function call from LUA when lua2c plugin L2C is used
-int Lua2cWrapper(lua_State* luaState, char *funcname, Lua2cFunctionT callback) {
+int Lua2cWrapper(lua_State* luaState, const char *funcname, Lua2cFunctionT callback) {
- json_object *argsJ= LuaPopArgs(luaState, LUA_FIST_ARG+1);
+ json_object *argsJ = LuaPopArgs(luaState, LUA_FIST_ARG);
int response = (*callback) (funcname, argsJ);
// push response to LUA
diff --git a/controller/ctl-lua.h b/controller/ctl-lua.h
index d41c6a5..0b8de45 100644
--- a/controller/ctl-lua.h
+++ b/controller/ctl-lua.h
@@ -59,13 +59,13 @@ extern "C" {
int LuaLibInit ();
-typedef int (*Lua2cFunctionT)(char *funcname, json_object *argsJ);
-typedef int (*Lua2cWrapperT) (lua_State* luaState, char *funcname, Lua2cFunctionT callback);
+typedef int (*Lua2cFunctionT)(const char *funcname, json_object *argsJ);
+typedef int (*Lua2cWrapperT) (lua_State* luaState, const char *funcname, Lua2cFunctionT callback);
#define CTLP_LUALOAD Lua2cWrapperT Lua2cWrap;
-#define CTLP_LUA2C(FuncName, label,argsJ) static int FuncName(char*label,json_object*argsJ);\
+#define CTLP_LUA2C(FuncName, label, argsJ) static int FuncName(const char*label,json_object*argsJ);\
int lua2c_ ## FuncName(lua_State* luaState){return((*Lua2cWrap)(luaState, MACRO_STR_VALUE(FuncName), FuncName));};\
- static int FuncName(char* label, json_object* argsJ)
+ static int FuncName(const char* label, json_object* argsJ)
typedef enum {
LUA_DOCALL,
@@ -76,7 +76,7 @@ typedef enum {
int LuaConfigLoad();
int LuaConfigExec();
void LuaL2cNewLib(const char *label, luaL_Reg *l2cFunc, int count);
-int Lua2cWrapper(lua_State* luaState, char *funcname, Lua2cFunctionT callback);
+int Lua2cWrapper(lua_State* luaState, const char *funcname, Lua2cFunctionT callback);
int LuaCallFunc (CtlActionT *action, json_object *queryJ) ;
void ctlapi_lua_docall (afb_req request);
void ctlapi_lua_dostring (afb_req request);
diff --git a/controller/ctl-plugin.c b/controller/ctl-plugin.c
index 1be97d4..9e4e419 100644
--- a/controller/ctl-plugin.c
+++ b/controller/ctl-plugin.c
@@ -65,11 +65,10 @@ int PluginGetCB (CtlActionT *action , json_object *callbackJ) {
OnErrorExit:
return 1;
-
}
// Wrapper to Lua2c plugin command add context and delegate to LuaWrapper
-STATIC int DispatchOneL2c(lua_State* luaState, char *funcname, Lua2cFunctionT callback) {
+STATIC int DispatchOneL2c(lua_State* luaState, const char *funcname, Lua2cFunctionT callback) {
#ifndef CONTROL_SUPPORT_LUA
AFB_ERROR("CTL-ONE-L2C: LUA support not selected (cf:CONTROL_SUPPORT_LUA) in config.cmake");
return 1;