Skip to content
Snippets Groups Projects
Verified Commit ffd0092f authored by Tomas Krizek's avatar Tomas Krizek Committed by Petr Špaček
Browse files

daemon/main: remove useless l_dosandboxfile macro

The exact same function is implemented as luaL_dofile() in Lua 5.1,
there seems to be no reason to use our project-specific macro for it.

https://www.lua.org/manual/5.1/manual.html#luaL_dofile
parent ee2f97a8
No related branches found
No related tags found
1 merge request!909daemon/main: support multiple config files
......@@ -66,9 +66,6 @@ const size_t CLEANUP_TIMER = 5*60*1000;
/* Execute byte code */
#define l_dobytecode(L, arr, len, name) \
(luaL_loadbuffer((L), (arr), (len), (name)) || lua_pcall((L), 0, LUA_MULTRET, 0))
/** Load file in a sandbox environment. */
#define l_dosandboxfile(L, filename) \
(luaL_loadfile((L), (filename)) || engine_pcall((L), 0))
/*
* Global bindings.
......@@ -698,7 +695,7 @@ int engine_ipc(struct engine *engine, const char *expr)
int engine_load_sandbox(struct engine *engine)
{
/* Init environment */
int ret = l_dosandboxfile(engine->L, LIBDIR "/sandbox.lua");
int ret = luaL_dofile(engine->L, LIBDIR "/sandbox.lua");
if (ret != 0) {
fprintf(stderr, "[system] error %s\n", lua_tostring(engine->L, -1));
lua_pop(engine->L, 1);
......@@ -711,7 +708,7 @@ int engine_load_sandbox(struct engine *engine)
int engine_loadconf(struct engine *engine, const char *config_path)
{
assert(config_path != NULL);
int ret = l_dosandboxfile(engine->L, config_path);
int ret = luaL_dofile(engine->L, config_path);
if (ret != 0) {
fprintf(stderr, "%s\n", lua_tostring(engine->L, -1));
lua_pop(engine->L, 1);
......@@ -722,7 +719,7 @@ int engine_loadconf(struct engine *engine, const char *config_path)
int engine_load_defaults(struct engine *engine)
{
/* Load defaults */
int ret = l_dosandboxfile(engine->L, LIBDIR "/config.lua");
int ret = luaL_dofile(engine->L, LIBDIR "/config.lua");
if (ret != 0) {
fprintf(stderr, "%s\n", lua_tostring(engine->L, -1));
lua_pop(engine->L, 1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment