aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_dns.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-05-05 14:26:20 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-05-05 14:26:20 +0100
commitdedb8506630e0de3f384d19c781993dedd73a2d5 (patch)
tree4855da0433bd019a03c727ad53175bd77745d228 /src/lua/lua_dns.c
parenta4c9f20fa7f30124253bbcc807eaec9cce65ee48 (diff)
downloadrspamd-dedb8506630e0de3f384d19c781993dedd73a2d5.tar.gz
rspamd-dedb8506630e0de3f384d19c781993dedd73a2d5.zip
[Feature] Use rspamd specific type checks for userdata
Diffstat (limited to 'src/lua/lua_dns.c')
-rw-r--r--src/lua/lua_dns.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lua/lua_dns.c b/src/lua/lua_dns.c
index c52569225..1a778c53d 100644
--- a/src/lua/lua_dns.c
+++ b/src/lua/lua_dns.c
@@ -70,7 +70,7 @@ static const struct luaL_reg dns_resolverlib_m[] = {
struct rspamd_dns_resolver *
lua_check_dns_resolver (lua_State * L)
{
- void *ud = luaL_checkudata (L, 1, "rspamd{resolver}");
+ void *ud = rspamd_lua_check_udata (L, 1, "rspamd{resolver}");
luaL_argcheck (L, ud != NULL, 1, "'resolver' expected");
return ud ? *((struct rspamd_dns_resolver **)ud) : NULL;
}
@@ -225,10 +225,10 @@ lua_dns_resolver_init (lua_State *L)
struct event_base *base, **pbase;
/* Check args */
- pbase = luaL_checkudata (L, 1, "rspamd{ev_base}");
+ pbase = rspamd_lua_check_udata (L, 1, "rspamd{ev_base}");
luaL_argcheck (L, pbase != NULL, 1, "'ev_base' expected");
base = pbase ? *(pbase) : NULL;
- pcfg = luaL_checkudata (L, 2, "rspamd{config}");
+ pcfg = rspamd_lua_check_udata (L, 2, "rspamd{config}");
luaL_argcheck (L, pcfg != NULL, 2, "'config' expected");
cfg = pcfg ? *(pcfg) : NULL;
@@ -266,10 +266,10 @@ lua_dns_resolver_resolve_common (lua_State *L,
/* Check arguments */
if (lua_type (L, first) == LUA_TUSERDATA) {
/* Legacy version */
- psession = luaL_checkudata (L, first, "rspamd{session}");
+ psession = rspamd_lua_check_udata (L, first, "rspamd{session}");
luaL_argcheck (L, psession != NULL, first, "'session' expected");
session = psession ? *(psession) : NULL;
- ppool = luaL_checkudata (L, first + 1, "rspamd{mempool}");
+ ppool = rspamd_lua_check_udata (L, first + 1, "rspamd{mempool}");
luaL_argcheck (L, ppool != NULL, first + 1, "'mempool' expected");
pool = ppool ? *(ppool) : NULL;
to_resolve = luaL_checkstring (L, first + 2);
@@ -315,7 +315,7 @@ lua_dns_resolver_resolve_common (lua_State *L,
if (task == NULL) {
lua_pushstring (L, "session");
lua_gettable (L, -2);
- if (luaL_checkudata (L, -1, "rspamd{session}")) {
+ if (rspamd_lua_check_udata (L, -1, "rspamd{session}")) {
session = *(struct rspamd_async_session **)lua_touserdata (L, -1);
}
else {
@@ -325,7 +325,7 @@ lua_dns_resolver_resolve_common (lua_State *L,
lua_pushstring (L, "pool");
lua_gettable (L, -2);
- if (luaL_checkudata (L, -1, "rspamd{mempool}")) {
+ if (rspamd_lua_check_udata (L, -1, "rspamd{mempool}")) {
pool = *(rspamd_mempool_t **)lua_touserdata (L, -1);
}
else {