summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-07-26 12:23:07 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-07-26 12:23:07 +0100
commit20f19b78d042c6db9226ab0f2b7403cc0e49a070 (patch)
tree4480471cd84cb1730326829b112ee3000eebb100
parent5a7de4519c7ac8ff2d6887465ca0baecbe739d65 (diff)
downloadrspamd-20f19b78d042c6db9226ab0f2b7403cc0e49a070.tar.gz
rspamd-20f19b78d042c6db9226ab0f2b7403cc0e49a070.zip
[Minor] Simplify hashes definitions
-rw-r--r--src/libmime/filter.c1
-rw-r--r--src/libmime/filter.h16
2 files changed, 5 insertions, 12 deletions
diff --git a/src/libmime/filter.c b/src/libmime/filter.c
index 1c836e4a7..efdcb24a0 100644
--- a/src/libmime/filter.c
+++ b/src/libmime/filter.c
@@ -255,6 +255,7 @@ insert_metric_result (struct rspamd_task *task,
sym_cpy = rspamd_mempool_strdup (task->task_pool, symbol);
k = kh_put (rspamd_symbols_hash, metric_res->symbols,
sym_cpy, &ret);
+ g_assert (ret > 0);
s = &kh_value (metric_res->symbols, k);
memset (s, 0, sizeof (*s));
diff --git a/src/libmime/filter.h b/src/libmime/filter.h
index b6d7a4359..0b962e6aa 100644
--- a/src/libmime/filter.h
+++ b/src/libmime/filter.h
@@ -28,12 +28,8 @@ enum rspamd_symbol_result_flags {
/**
* Rspamd symbol
*/
-KHASH_INIT (rspamd_options_hash,
- const char *,
- struct rspamd_symbol_option *,
- true,
- rspamd_str_hash,
- rspamd_str_equal);
+KHASH_MAP_INIT_STR (rspamd_options_hash, struct rspamd_symbol_option *);
+
struct rspamd_symbol_result {
double score; /**< symbol's score */
khash_t(rspamd_options_hash) *options; /**< list of symbol's options */
@@ -47,13 +43,9 @@ struct rspamd_symbol_result {
/**
* Result of metric processing
*/
-KHASH_INIT (rspamd_symbols_hash,
- const char *,
- struct rspamd_symbol_result,
- true,
- rspamd_str_hash,
- rspamd_str_equal);
+KHASH_MAP_INIT_STR (rspamd_symbols_hash, struct rspamd_symbol_result);
KHASH_MAP_INIT_INT (rspamd_symbols_group_hash, double);
+
struct rspamd_metric_result {
double score; /**< total score */
double grow_factor; /**< current grow factor */