diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-10-09 01:08:58 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-10-09 01:08:58 +0100 |
commit | aeb484cac64fbdc876f0e1a58efa1490cdf029f5 (patch) | |
tree | beebd3bf93f17d461e813605cb4b4fb6dac92f17 /src/libserver | |
parent | f1979c2e4d51a0114b0716203090171d6c92b82c (diff) | |
download | rspamd-aeb484cac64fbdc876f0e1a58efa1490cdf029f5.tar.gz rspamd-aeb484cac64fbdc876f0e1a58efa1490cdf029f5.zip |
Place symbol definition in metric->symbols hash.
Diffstat (limited to 'src/libserver')
-rw-r--r-- | src/libserver/dynamic_cfg.c | 6 | ||||
-rw-r--r-- | src/libserver/symbols_cache.c | 10 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/libserver/dynamic_cfg.c b/src/libserver/dynamic_cfg.c index 97bb2c91e..01bfb83b5 100644 --- a/src/libserver/dynamic_cfg.c +++ b/src/libserver/dynamic_cfg.c @@ -48,7 +48,7 @@ apply_dynamic_conf (const ucl_object_t *top, struct rspamd_config *cfg) ucl_object_iter_t it = NULL; struct metric *real_metric; struct metric_action *cur_action; - gdouble *w; + struct rspamd_symbol_def *s; while ((cur_elt = ucl_iterate_object (top, &it, true))) { if (ucl_object_type (cur_elt) != UCL_OBJECT) { @@ -82,9 +82,9 @@ apply_dynamic_conf (const ucl_object_t *top, struct rspamd_config *cfg) const ucl_object_t *v = ucl_object_find_key (it_val, "value"); - if((w = g_hash_table_lookup (real_metric->symbols, + if((s = g_hash_table_lookup (real_metric->symbols, ucl_object_tostring (n))) != NULL) { - *w = ucl_object_todouble (v); + *s->weight_ptr = ucl_object_todouble (v); } } else { diff --git a/src/libserver/symbols_cache.c b/src/libserver/symbols_cache.c index 6b24f3935..f40847bd3 100644 --- a/src/libserver/symbols_cache.c +++ b/src/libserver/symbols_cache.c @@ -315,7 +315,7 @@ register_symbol_common (struct symbols_cache **cache, struct symbols_cache *pcache = *cache; GList **target, *cur; struct metric *m; - double *w; + struct rspamd_symbol_def *s; gboolean skipped; if (*cache == NULL) { @@ -355,10 +355,10 @@ register_symbol_common (struct symbols_cache **cache, /* Handle weight using default metric */ if (pcache->cfg && pcache->cfg->default_metric && - (w = + (s = g_hash_table_lookup (pcache->cfg->default_metric->symbols, name)) != NULL) { - item->s->weight = weight * (*w); + item->s->weight = weight * (*s->weight_ptr); } else { item->s->weight = weight; @@ -679,9 +679,11 @@ rspamd_symbols_cache_metric_cb (gpointer k, gpointer v, gpointer ud) struct symbols_cache *cache = (struct symbols_cache *)ud; GList *cur; const gchar *sym = k; - gdouble weight = *(gdouble *)v; + struct rspamd_symbol_def *s = (struct rspamd_symbol_def *)v; + gdouble weight; struct cache_item *item; + weight = *s->weight_ptr; cur = cache->negative_items; while (cur) { item = cur->data; |