summaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-06 00:25:39 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-06 00:25:39 +0000
commitb66a09265f3e2c139b5b021a91aad4242d04de57 (patch)
tree108acd5414eb16adab3fe48b7ef115a77b921c8f /src/lua
parent50cb1d594e2cd6430d5a632ac424b6c9383c77c9 (diff)
downloadrspamd-b66a09265f3e2c139b5b021a91aad4242d04de57.tar.gz
rspamd-b66a09265f3e2c139b5b021a91aad4242d04de57.zip
More fixes to regexp module.
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/lua_regexp.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/lua/lua_regexp.c b/src/lua/lua_regexp.c
index 64312be70..d363ee4a6 100644
--- a/src/lua/lua_regexp.c
+++ b/src/lua/lua_regexp.c
@@ -141,10 +141,13 @@ lua_regexp_get_cached (lua_State *L)
{
struct rspamd_lua_regexp *new, **pnew;
const gchar *line;
+ rspamd_regexp_t *re;
line = luaL_checkstring (L, 1);
- new = rspamd_regexp_cache_query (NULL, line, NULL);
- if (new) {
+ re = rspamd_regexp_cache_query (NULL, line, NULL);
+ if (re) {
+ new = g_slice_alloc (sizeof (struct rspamd_lua_regexp));
+ new->re = re;
pnew = lua_newuserdata (L, sizeof (struct rspamd_lua_regexp *));
rspamd_lua_setclass (L, "rspamd{regexp}", -1);
*pnew = new;
@@ -176,11 +179,15 @@ lua_regexp_create_cached (lua_State *L)
{
const gchar *line;
struct rspamd_lua_regexp *new, **pnew;
+ rspamd_regexp_t *re;
line = luaL_checkstring (L, 1);
- new = rspamd_regexp_cache_query (NULL, line, NULL);
- if (new) {
+ re = rspamd_regexp_cache_query (NULL, line, NULL);
+ if (re) {
+ new = g_slice_alloc (sizeof (struct rspamd_lua_regexp));
+ new->re = re;
pnew = lua_newuserdata (L, sizeof (struct rspamd_lua_regexp *));
+
rspamd_lua_setclass (L, "rspamd{regexp}", -1);
*pnew = new;
}