diff mbox series

[1/3] Lua: Rename lua_init() to lua_session_init()

Message ID B132A47A-8CB2-43BC-B2B7-E08E89A367C1@siemens.com
State Accepted
Headers show
Series [1/3] Lua: Rename lua_init() to lua_session_init() | expand

Commit Message

Storm, Christian June 13, 2024, 4:11 p.m. UTC
The function lua_init() is actually only used for sessions.
Rename it accordingly in preparation to a global Lua state
initialization function.

Signed-off-by: Christian Storm <christian.storm@siemens.com>
---
 corelib/lua_interface.c      | 2 +-
 handlers/lua_scripthandler.c | 2 +-
 include/lua_util.h           | 4 ++--
 parser/parser.c              | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/corelib/lua_interface.c b/corelib/lua_interface.c
index 5438f536..cf13d685 100644
--- a/corelib/lua_interface.c
+++ b/corelib/lua_interface.c
@@ -1582,7 +1582,7 @@  int lua_handlers_init(lua_State *L)
 	return ret;
 }
 
-lua_State *lua_init(struct dict *bootenv)
+lua_State *lua_session_init(struct dict *bootenv)
 {
 	lua_State *L = luaL_newstate(); /* opens Lua */
 
diff --git a/handlers/lua_scripthandler.c b/handlers/lua_scripthandler.c
index 009c0557..bfc40d77 100644
--- a/handlers/lua_scripthandler.c
+++ b/handlers/lua_scripthandler.c
@@ -74,7 +74,7 @@  static int start_lua_script(struct img_type *img, void *data)
 		TRACE("Executing with global state");
 		L = img->L;
 	} else {
-		L = lua_init(img->bootloader);
+		L = lua_session_init(img->bootloader);
 	}
 
 	if (!L) {
diff --git a/include/lua_util.h b/include/lua_util.h
index fd5ee5c2..1cbd4b1a 100644
--- a/include/lua_util.h
+++ b/include/lua_util.h
@@ -21,7 +21,7 @@  typedef enum {
 
 void LUAstackDump (lua_State *L);
 int run_lua_script(lua_State *L, const char *script, bool load, const char *function, char *parms);
-lua_State *lua_init(struct dict *bootenv);
+lua_State *lua_session_init(struct dict *bootenv);
 int lua_load_buffer(lua_State *L, const char *buf);
 int lua_parser_fn(lua_State *L, const char *fcn, struct img_type *img);
 int lua_handler_fn(lua_State *L, const char *fcn, const char *parms);
@@ -100,7 +100,7 @@  struct img_type;
 #define lua_State void
 #define lua_exit(L)
 #define lua_close(L)
-static inline lua_State *lua_init(struct dict __attribute__ ((__unused__)) *bootenv) { return NULL;}
+static inline lua_State *lua_session_init(struct dict __attribute__ ((__unused__)) *bootenv) { return NULL;}
 static inline int lua_load_buffer(lua_State __attribute__ ((__unused__)) *L, 
 					const char __attribute__ ((__unused__)) *buf) {return 1;}
 static inline int lua_parser_fn(lua_State __attribute__ ((__unused__)) *L,
diff --git a/parser/parser.c b/parser/parser.c
index 04d7b72c..b092ebf6 100644
--- a/parser/parser.c
+++ b/parser/parser.c
@@ -1024,7 +1024,7 @@  static int parser(parsertype p, void *cfg, struct swupdate_cfg *swcfg)
 		swcfg->embscript = get_field_string(p, scriptnode, NULL);
 	}
 
-	L = lua_init(&swcfg->bootloader);
+	L = lua_session_init(&swcfg->bootloader);
 
 	if (swcfg->embscript) {
 		if (!L) {