diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-05-27 17:33:56 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-05-27 17:33:56 +0100 |
commit | 6e00dea760aca106de1021e5a9740b9511a6e0b2 (patch) | |
tree | dc5f5a67564d419f67ae03e63db45c8b81b822be /src/libserver | |
parent | ce9a26d98932473c449e5d4bf39dbb93a6d7a924 (diff) | |
download | rspamd-6e00dea760aca106de1021e5a9740b9511a6e0b2.tar.gz rspamd-6e00dea760aca106de1021e5a9740b9511a6e0b2.zip |
Refactor and unify function names.
Diffstat (limited to 'src/libserver')
-rw-r--r-- | src/libserver/cfg_rcl.c | 2 | ||||
-rw-r--r-- | src/libserver/cfg_utils.c | 2 | ||||
-rw-r--r-- | src/libserver/symbols_cache.c | 24 | ||||
-rw-r--r-- | src/libserver/symbols_cache.h | 23 |
4 files changed, 22 insertions, 29 deletions
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c index 3686fde06..3e8e639e0 100644 --- a/src/libserver/cfg_rcl.c +++ b/src/libserver/cfg_rcl.c @@ -1136,7 +1136,7 @@ rspamd_rcl_composite_handler (rspamd_mempool_t *pool, composite); if (new) { - register_virtual_symbol (cfg->cache, composite_name, 1); + rspamd_symbols_cache_add_symbol_virtual (cfg->cache, composite_name, 1); } return TRUE; diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c index 12199436c..fe7b47b30 100644 --- a/src/libserver/cfg_utils.c +++ b/src/libserver/cfg_utils.c @@ -680,7 +680,7 @@ symbols_classifiers_callback (gpointer key, gpointer value, gpointer ud) { struct rspamd_config *cfg = ud; - register_virtual_symbol (cfg->cache, key, 1.0); + rspamd_symbols_cache_add_symbol_virtual (cfg->cache, key, 1.0); } void diff --git a/src/libserver/symbols_cache.c b/src/libserver/symbols_cache.c index 25bccc6e9..be7ef98d9 100644 --- a/src/libserver/symbols_cache.c +++ b/src/libserver/symbols_cache.c @@ -306,7 +306,7 @@ rspamd_symbols_cache_save_items (struct symbols_cache *cache, const gchar *name) } void -register_symbol_common (struct symbols_cache *cache, +rspamd_symbols_cache_add_symbol (struct symbols_cache *cache, const gchar *name, double weight, gint priority, @@ -352,10 +352,10 @@ register_symbol_common (struct symbols_cache *cache, } void -register_symbol (struct symbols_cache *cache, const gchar *name, double weight, +rspamd_symbols_cache_add_symbol_normal (struct symbols_cache *cache, const gchar *name, double weight, symbol_func_t func, gpointer user_data) { - register_symbol_common (cache, + rspamd_symbols_cache_add_symbol (cache, name, weight, 0, @@ -365,11 +365,11 @@ register_symbol (struct symbols_cache *cache, const gchar *name, double weight, } void -register_virtual_symbol (struct symbols_cache *cache, +rspamd_symbols_cache_add_symbol_virtual (struct symbols_cache *cache, const gchar *name, double weight) { - register_symbol_common (cache, + rspamd_symbols_cache_add_symbol (cache, name, weight, 0, @@ -379,13 +379,13 @@ register_virtual_symbol (struct symbols_cache *cache, } void -register_callback_symbol (struct symbols_cache *cache, +rspamd_symbols_cache_add_symbol_callback (struct symbols_cache *cache, const gchar *name, double weight, symbol_func_t func, gpointer user_data) { - register_symbol_common (cache, + rspamd_symbols_cache_add_symbol (cache, name, weight, 0, @@ -395,14 +395,14 @@ register_callback_symbol (struct symbols_cache *cache, } void -register_callback_symbol_priority (struct symbols_cache *cache, +rspamd_symbols_cache_add_symbol_callback_prio (struct symbols_cache *cache, const gchar *name, double weight, gint priority, symbol_func_t func, gpointer user_data) { - register_symbol_common (cache, + rspamd_symbols_cache_add_symbol (cache, name, weight, priority, @@ -448,7 +448,7 @@ rspamd_symbols_cache_new (void) } gboolean -init_symbols_cache (struct symbols_cache* cache, +rspamd_symbols_cache_init (struct symbols_cache* cache, struct rspamd_config *cfg) { gboolean res; @@ -563,7 +563,7 @@ rspamd_symbols_cache_metric_validate_cb (gpointer k, gpointer v, gpointer ud) } gboolean -validate_cache (struct symbols_cache *cache, +rspamd_symbols_cache_validate (struct symbols_cache *cache, struct rspamd_config *cfg, gboolean strict) { @@ -611,7 +611,7 @@ validate_cache (struct symbols_cache *cache, } gboolean -call_symbol_callback (struct rspamd_task * task, +rspamd_symbols_cache_process_symbol (struct rspamd_task * task, struct symbols_cache * cache, gpointer *save) { diff --git a/src/libserver/symbols_cache.h b/src/libserver/symbols_cache.h index 8eee4e690..c0b43ee6b 100644 --- a/src/libserver/symbols_cache.h +++ b/src/libserver/symbols_cache.h @@ -59,7 +59,7 @@ void rspamd_symbols_cache_destroy (struct symbols_cache *cache); /** * Load symbols cache from file, must be called _after_ init_symbols_cache */ -gboolean init_symbols_cache (struct symbols_cache* cache, +gboolean rspamd_symbols_cache_init (struct symbols_cache* cache, struct rspamd_config *cfg); /** @@ -68,7 +68,7 @@ gboolean init_symbols_cache (struct symbols_cache* cache, * @param func pointer to handler * @param user_data pointer to user_data */ -void register_symbol (struct symbols_cache *cache, +void rspamd_symbols_cache_add_symbol_normal (struct symbols_cache *cache, const gchar *name, double weight, symbol_func_t func, @@ -79,7 +79,7 @@ void register_symbol (struct symbols_cache *cache, * Register virtual symbol * @param name name of symbol */ -void register_virtual_symbol (struct symbols_cache *cache, +void rspamd_symbols_cache_add_symbol_virtual (struct symbols_cache *cache, const gchar *name, double weight); @@ -89,7 +89,7 @@ void register_virtual_symbol (struct symbols_cache *cache, * @param func pointer to handler * @param user_data pointer to user_data */ -void register_callback_symbol (struct symbols_cache *cache, +void rspamd_symbols_cache_add_symbol_callback (struct symbols_cache *cache, const gchar *name, double weight, symbol_func_t func, @@ -101,7 +101,7 @@ void register_callback_symbol (struct symbols_cache *cache, * @param func pointer to handler * @param user_data pointer to user_data */ -void register_callback_symbol_priority (struct symbols_cache *cache, +void rspamd_symbols_cache_add_symbol_callback_prio (struct symbols_cache *cache, const gchar *name, double weight, gint priority, @@ -118,8 +118,7 @@ void register_callback_symbol_priority (struct symbols_cache *cache, * @param user_data * @param type */ -void -register_symbol_common (struct symbols_cache *cache, +void rspamd_symbols_cache_add_symbol (struct symbols_cache *cache, const gchar *name, double weight, gint priority, @@ -133,23 +132,17 @@ register_symbol_common (struct symbols_cache *cache, * @param cache symbols cache * @param saved_item pointer to currently saved item */ -gboolean call_symbol_callback (struct rspamd_task *task, +gboolean rspamd_symbols_cache_process_symbol (struct rspamd_task *task, struct symbols_cache *cache, gpointer *save); /** - * Remove all dynamic rules from cache - * @param cache symbols cache - */ -void remove_dynamic_rules (struct symbols_cache *cache); - -/** * Validate cache items agains theirs weights defined in metrics * @param cache symbols cache * @param cfg configuration * @param strict do strict checks - symbols MUST be described in metrics */ -gboolean validate_cache (struct symbols_cache *cache, +gboolean rspamd_symbols_cache_validate (struct symbols_cache *cache, struct rspamd_config *cfg, gboolean strict); |