From: Tomas Krizek Date: Tue, 10 Dec 2019 18:22:16 +0000 (+0100) Subject: daemon/main: remove useless l_dosandboxfile macro X-Git-Tag: v5.0.0~18^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ffd0092fe48289b2f70fd6831898a3385f0e690f;p=thirdparty%2Fknot-resolver.git 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 --- diff --git a/daemon/engine.c b/daemon/engine.c index 796f05549..72f50c672 100644 --- a/daemon/engine.c +++ b/daemon/engine.c @@ -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);