aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-05-26 22:08:09 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-05-26 22:08:09 +0100
commit6d230abb527752ef25e352d8d09669020774e75f (patch)
treeb68a6c445d6cfca183c84ef34034152a68d97440 /src/lua
parent2401ecfcf47963d1d7ac24f5d958a61d28771655 (diff)
downloadrspamd-6d230abb527752ef25e352d8d09669020774e75f.tar.gz
rspamd-6d230abb527752ef25e352d8d09669020774e75f.zip
Adopt lua API.
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/lua_cfg_file.c2
-rw-r--r--src/lua/lua_config.c10
-rw-r--r--src/lua/lua_util.c6
3 files changed, 10 insertions, 8 deletions
diff --git a/src/lua/lua_cfg_file.c b/src/lua/lua_cfg_file.c
index c73173f97..aae50ea3e 100644
--- a/src/lua/lua_cfg_file.c
+++ b/src/lua/lua_cfg_file.c
@@ -212,7 +212,7 @@ rspamd_lua_post_load_config (struct rspamd_config *cfg)
}
else {
g_hash_table_insert (cfg->composite_symbols, sym, expr);
- register_virtual_symbol (&cfg->cache, sym, 1);
+ register_virtual_symbol (cfg->cache, sym, 1);
}
}
}
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c
index 938c0fa62..cb12c970b 100644
--- a/src/lua/lua_config.c
+++ b/src/lua/lua_config.c
@@ -867,7 +867,7 @@ rspamd_register_symbol_fromlua (lua_State *L,
cd->L = L;
cd->symbol = rspamd_mempool_strdup (cfg->cfg_pool, name);
- register_symbol_common (&cfg->cache,
+ register_symbol_common (cfg->cache,
name,
weight,
priority,
@@ -957,7 +957,7 @@ lua_config_register_symbols (lua_State *L)
lua_pushvalue (L, -2);
sym = rspamd_mempool_strdup (cfg->cfg_pool,
luaL_checkstring (L, -2));
- register_virtual_symbol (&cfg->cache, sym, weight);
+ register_virtual_symbol (cfg->cache, sym, weight);
lua_pop (L, 2);
}
lua_pop (L, 1);
@@ -965,7 +965,7 @@ lua_config_register_symbols (lua_State *L)
else if (lua_type (L, i) == LUA_TSTRING) {
sym = rspamd_mempool_strdup (cfg->cfg_pool,
luaL_checkstring (L, i));
- register_virtual_symbol (&cfg->cache, sym, weight);
+ register_virtual_symbol (cfg->cache, sym, weight);
}
}
}
@@ -984,7 +984,7 @@ lua_config_register_virtual_symbol (lua_State * L)
name = rspamd_mempool_strdup (cfg->cfg_pool, luaL_checkstring (L, 2));
weight = luaL_checknumber (L, 3);
if (name) {
- register_virtual_symbol (&cfg->cache, name, weight);
+ register_virtual_symbol (cfg->cache, name, weight);
}
}
return 0;
@@ -1157,7 +1157,7 @@ lua_config_add_composite (lua_State * L)
composite);
if (new) {
- register_virtual_symbol (&cfg->cache, name, 1);
+ register_virtual_symbol (cfg->cache, name, 1);
}
ret = TRUE;
diff --git a/src/lua/lua_util.c b/src/lua/lua_util.c
index d93811dae..297ee406d 100644
--- a/src/lua/lua_util.c
+++ b/src/lua/lua_util.c
@@ -104,6 +104,7 @@ lua_util_load_rspamd_config (lua_State *L)
if (cfg_name) {
cfg = g_malloc0 (sizeof (struct rspamd_config));
rspamd_init_cfg (cfg, FALSE);
+ cfg->cache = rspamd_symbols_cache_new ();
if (rspamd_config_read (cfg, cfg_name, NULL, NULL, NULL)) {
msg_err ("cannot load config from %s", cfg_name);
@@ -111,7 +112,7 @@ lua_util_load_rspamd_config (lua_State *L)
}
else {
rspamd_config_post_load (cfg);
- init_symbols_cache (cfg->cfg_pool, cfg->cache, cfg, NULL, TRUE);
+ init_symbols_cache (cfg->cache, cfg);
pcfg = lua_newuserdata (L, sizeof (struct rspamd_config *));
rspamd_lua_setclass (L, "rspamd{config}", -1);
*pcfg = cfg;
@@ -136,6 +137,7 @@ lua_util_config_from_ucl (lua_State *L)
rspamd_init_cfg (cfg, FALSE);
cfg->lua_state = L;
cfg->rcl_obj = obj;
+ cfg->cache = rspamd_symbols_cache_new ();
top = rspamd_rcl_config_init ();
if (!rspamd_rcl_parse (top, cfg, cfg->cfg_pool, cfg->rcl_obj, &err)) {
@@ -145,7 +147,7 @@ lua_util_config_from_ucl (lua_State *L)
}
else {
rspamd_config_post_load (cfg);
- init_symbols_cache (cfg->cfg_pool, cfg->cache, cfg, NULL, TRUE);
+ init_symbols_cache (cfg->cache, cfg);
pcfg = lua_newuserdata (L, sizeof (struct rspamd_config *));
rspamd_lua_setclass (L, "rspamd{config}", -1);
*pcfg = cfg;