aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_shingles.cxx
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2025-01-06 12:57:07 +0000
committerVsevolod Stakhov <vsevolod@rspamd.com>2025-01-06 12:57:07 +0000
commit5327bde3c2809052d12657736e2de8da5fd60401 (patch)
tree8038af0ce50eca9dfef531e00e50ac56740f1321 /src/lua/lua_shingles.cxx
parent0a449230d76840ec6b40cd06c8e93f2e6febb038 (diff)
downloadrspamd-vstakhov-lua-shingles.tar.gz
rspamd-vstakhov-lua-shingles.zip
[Feature] Pass shingles to Lua scriptsvstakhov-lua-shingles
Diffstat (limited to 'src/lua/lua_shingles.cxx')
-rw-r--r--src/lua/lua_shingles.cxx8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/lua/lua_shingles.cxx b/src/lua/lua_shingles.cxx
index 355a9e7f2..b19a00c08 100644
--- a/src/lua/lua_shingles.cxx
+++ b/src/lua/lua_shingles.cxx
@@ -18,8 +18,6 @@
#include "shingles.h"
#include "fmt/format.h"
-#define RSPAMD_SHINGLE_CLASS "rspamd{shingle}"
-
/***
* @module rspamd_shingle
* This module provides methods to work with text shingles
@@ -58,9 +56,9 @@ static const struct luaL_reg shinglelib_m[] = {
static struct rspamd_shingle *
lua_check_shingle(lua_State *L, int pos)
{
- void *ud = rspamd_lua_check_udata(L, pos, RSPAMD_SHINGLE_CLASS);
+ void *ud = rspamd_lua_check_udata(L, pos, RSPAMD_LUA_SHINGLE_CLASS);
luaL_argcheck(L, ud != nullptr, pos, "'shingle' expected");
- return static_cast<struct rspamd_shingle *>(ud);
+ return *static_cast<struct rspamd_shingle **>(ud);
}
static int
@@ -117,6 +115,6 @@ lua_shingle_get_string(lua_State *L)
void luaopen_shingle(lua_State *L)
{
- rspamd_lua_new_class(L, RSPAMD_SHINGLE_CLASS, shinglelib_m);
+ rspamd_lua_new_class(L, RSPAMD_LUA_SHINGLE_CLASS, shinglelib_m);
lua_pop(L, 1);
}