aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_cfg_file.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-10-09 01:08:58 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-10-09 01:08:58 +0100
commitaeb484cac64fbdc876f0e1a58efa1490cdf029f5 (patch)
treebeebd3bf93f17d461e813605cb4b4fb6dac92f17 /src/lua/lua_cfg_file.c
parentf1979c2e4d51a0114b0716203090171d6c92b82c (diff)
downloadrspamd-aeb484cac64fbdc876f0e1a58efa1490cdf029f5.tar.gz
rspamd-aeb484cac64fbdc876f0e1a58efa1490cdf029f5.zip
Place symbol definition in metric->symbols hash.
Diffstat (limited to 'src/lua/lua_cfg_file.c')
-rw-r--r--src/lua/lua_cfg_file.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/lua/lua_cfg_file.c b/src/lua/lua_cfg_file.c
index 08f9e40db..c29b4b2b1 100644
--- a/src/lua/lua_cfg_file.c
+++ b/src/lua/lua_cfg_file.c
@@ -41,7 +41,8 @@ lua_process_metric (lua_State *L, const gchar *name, struct rspamd_config *cfg)
gchar *symbol, *old_desc;
const gchar *desc;
struct metric *metric;
- gdouble *score, *old_score;
+ gdouble *score;
+ struct rspamd_symbol_def *s;
/* Get module opt structure */
if ((metric = g_hash_table_lookup (cfg->metrics, name)) == NULL) {
@@ -100,16 +101,19 @@ lua_process_metric (lua_State *L, const gchar *name, struct rspamd_config *cfg)
continue;
}
/* Insert symbol */
- if ((old_score =
+ if ((s =
g_hash_table_lookup (metric->symbols, symbol)) != NULL) {
msg_info ("replacing weight for symbol %s: %.2f -> %.2f",
symbol,
- *old_score,
+ *s->weight_ptr,
*score);
- g_hash_table_replace (metric->symbols, symbol, score);
+ s->weight_ptr = score;
}
else {
- g_hash_table_insert (metric->symbols, symbol, score);
+ s = rspamd_mempool_alloc (cfg->cfg_pool, sizeof (*s));
+ s->name = symbol;
+ s->weight_ptr = score;
+ g_hash_table_insert (metric->symbols, symbol, s);
}
if ((metric_list =