diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-10-10 10:09:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-10 10:09:21 +0100 |
commit | 38e0750db654f6909c160b0bd205d251852004a7 (patch) | |
tree | 7cd2907fc5d316d77f53ffa07b7f6f8fd4cca0be /src/lua/lua_upstream.c | |
parent | 3288513ebccc10938b63735685bdadf42e708fa1 (diff) | |
parent | 1bf202d540865ebd8d4e5f0d21e067eff3102def (diff) | |
download | rspamd-38e0750db654f6909c160b0bd205d251852004a7.tar.gz rspamd-38e0750db654f6909c160b0bd205d251852004a7.zip |
Merge branch 'master' into arc-defaults
Diffstat (limited to 'src/lua/lua_upstream.c')
-rw-r--r-- | src/lua/lua_upstream.c | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/src/lua/lua_upstream.c b/src/lua/lua_upstream.c index 3c4f3f4c3..7ba77839f 100644 --- a/src/lua/lua_upstream.c +++ b/src/lua/lua_upstream.c @@ -569,30 +569,10 @@ lua_load_upstream_list (lua_State * L) void luaopen_upstream (lua_State * L) { - luaL_newmetatable (L, "rspamd{upstream_list}"); - lua_pushstring (L, "__index"); - lua_pushvalue (L, -2); - lua_settable (L, -3); - - lua_pushstring (L, "class"); - lua_pushstring (L, "rspamd{upstream_list}"); - lua_rawset (L, -3); - - luaL_register (L, NULL, upstream_list_m); + rspamd_lua_new_class (L, "rspamd{upstream_list}", upstream_list_m); + lua_pop (L, 1); rspamd_lua_add_preload (L, "rspamd_upstream_list", lua_load_upstream_list); - lua_pop (L, 1); /* remove metatable from stack */ - - luaL_newmetatable (L, "rspamd{upstream}"); - lua_pushstring (L, "__index"); - lua_pushvalue (L, -2); - lua_settable (L, -3); - - lua_pushstring (L, "class"); - lua_pushstring (L, "rspamd{upstream}"); - lua_rawset (L, -3); - - luaL_register (L, NULL, upstream_m); - - lua_pop (L, 1); /* remove metatable from stack */ + rspamd_lua_new_class (L, "rspamd{upstream}", upstream_m); + lua_pop (L, 1); } |