]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon/main: remove useless l_dosandboxfile macro
authorTomas Krizek <tomas.krizek@nic.cz>
Tue, 10 Dec 2019 18:22:16 +0000 (19:22 +0100)
committerPetr Špaček <petr.spacek@nic.cz>
Thu, 19 Dec 2019 08:31:25 +0000 (09:31 +0100)
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

daemon/engine.c

index 796f055492ca9dee716328efa83cac5f1ec029c1..72f50c672caf4aa44d493922e4fe9c82474e4a15 100644 (file)
@@ -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);