]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Simplify hashes definitions
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 26 Jul 2018 11:23:07 +0000 (12:23 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 26 Jul 2018 11:23:07 +0000 (12:23 +0100)
src/libmime/filter.c
src/libmime/filter.h

index 1c836e4a794fcf3c6b22e60d34017e59398898bb..efdcb24a05a264c92c346c2a19a77008515b9349 100644 (file)
@@ -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));
 
index b6d7a435900b74df4925829801f462cf4ff44f3a..0b962e6aa458a523399d5dc395e223352f14aa5c 100644 (file)
@@ -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                                        */