diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-08-25 13:17:21 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-08-25 13:17:21 +0100 |
commit | c2765b3eb3c3beb3d9f42dc061761df2e300904c (patch) | |
tree | 0f5924f4fd821b16a258465d9dcb0068e5332bf2 /src/lua/lua_dns.c | |
parent | a1be94b4c4b59de216e0b8b721a951b2325f7215 (diff) | |
download | rspamd-c2765b3eb3c3beb3d9f42dc061761df2e300904c.tar.gz rspamd-c2765b3eb3c3beb3d9f42dc061761df2e300904c.zip |
Use modules preload for lua.
Diffstat (limited to 'src/lua/lua_dns.c')
-rw-r--r-- | src/lua/lua_dns.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/lua/lua_dns.c b/src/lua/lua_dns.c index bd1306947..17620a289 100644 --- a/src/lua/lua_dns.c +++ b/src/lua/lua_dns.c @@ -27,7 +27,7 @@ /* Public prototypes */ struct rspamd_dns_resolver * lua_check_dns_resolver (lua_State * L); -gint luaopen_dns_resolver (lua_State * L); +void luaopen_dns_resolver (lua_State * L); /* Lua bindings */ LUA_FUNCTION_DEF (dns_resolver, init); @@ -356,7 +356,16 @@ lua_dns_resolver_resolve (lua_State *L) return 1; } -gint +static gint +lua_load_dns (lua_State * L) +{ + lua_newtable (L); + luaL_register (L, NULL, dns_resolverlib_f); + + return 1; +} + +void luaopen_dns_resolver (lua_State * L) { @@ -379,9 +388,8 @@ luaopen_dns_resolver (lua_State * L) LUA_ENUM (L, RDNS_REQUEST_AAA, RDNS_REQUEST_SRV); } - luaL_register (L, NULL, dns_resolverlib_m); - luaL_register (L, "rspamd_resolver", dns_resolverlib_f); + luaL_register (L, NULL, dns_resolverlib_m); + rspamd_lua_add_preload (L, "rspamd_resolver", lua_load_dns); lua_pop (L, 1); /* remove metatable from stack */ - return 1; } |