diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-02-03 14:55:55 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-02-03 14:55:55 +0000 |
commit | 1a5edd59f8c6a2c17b966737469dbf06e8b37804 (patch) | |
tree | a9d64fffe53a62c45d82980c944ff8bf9927a46c /src | |
parent | fdec113b0bd5d9f81a2701bb90fd640abc658271 (diff) | |
download | rspamd-1a5edd59f8c6a2c17b966737469dbf06e8b37804.tar.gz rspamd-1a5edd59f8c6a2c17b966737469dbf06e8b37804.zip |
Remove deprecated code.
Reported by: Andrey Vohmyanin
Diffstat (limited to 'src')
-rw-r--r-- | src/cfg_file.h | 5 | ||||
-rw-r--r-- | src/cfg_utils.c | 100 |
2 files changed, 0 insertions, 105 deletions
diff --git a/src/cfg_file.h b/src/cfg_file.h index a1b3db8ed..6f3489455 100644 --- a/src/cfg_file.h +++ b/src/cfg_file.h @@ -484,11 +484,6 @@ struct metric* check_metric_conf (struct config_file *cfg, struct metric *c); struct statfile* check_statfile_conf (struct config_file *cfg, struct statfile *c); /* - * XXX: Depreciated function, now it is used for - */ -gboolean parse_normalizer (struct config_file *cfg, struct statfile *st, const gchar *line); - -/* * Read XML configuration file */ gboolean read_rspamd_config (struct config_file *cfg, diff --git a/src/cfg_utils.c b/src/cfg_utils.c index 3e1503db7..8575b254b 100644 --- a/src/cfg_utils.c +++ b/src/cfg_utils.c @@ -657,106 +657,6 @@ check_worker_conf (struct config_file *cfg, struct worker_conf *c) return c; } -static double -internal_normalizer_func (struct config_file *cfg, long double score, void *data) -{ - long double max = *(double *)data; - - if (score < 0) { - return score; - } -#ifdef HAVE_TANHL - return max * tanhl (score / max); -#elif defined(HAVE_TANHL) - /* - * As some implementations of libm does not support tanhl, try to use - * tanh - */ - return max * tanh ((double) (score / max)); -#else - return score < max ? score / max : max; -#endif -} - -static gboolean -parse_internal_normalizer (struct config_file *cfg, struct statfile *st, const gchar *line) -{ - double *max; - gchar *err; - - /* Line contains maximum value for internal normalizer */ - max = memory_pool_alloc (cfg->cfg_pool, sizeof (double)); - - errno = 0; - *max = strtod (line, &err); - - if (errno != 0 || *err != '\0') { - msg_err ("cannot parse max number for internal normalizer"); - return FALSE; - } - - st->normalizer = internal_normalizer_func; - st->normalizer_data = (void *)max; - return TRUE; -} - -#ifdef WITH_LUA -static gboolean -parse_lua_normalizer (struct config_file *cfg, struct statfile *st, const gchar *line) -{ - gchar *code_begin; - GList *params = NULL; - gint len; - - code_begin = strchr (line, ':'); - - if (code_begin == NULL) { - /* Just function name without code */ - params = g_list_prepend (g_list_prepend (NULL, NULL), memory_pool_strdup (cfg->cfg_pool, line)); - } - else { - /* Postpone actual code load as lua libraries are not loaded */ - /* Put code to list */ - params = g_list_prepend (NULL, code_begin + 1); - /* Put function name */ - len = code_begin - line; - code_begin = memory_pool_alloc (cfg->cfg_pool, len + 1); - rspamd_strlcpy (code_begin, line, len + 1); - params = g_list_prepend (params, code_begin); - } - memory_pool_add_destructor (cfg->cfg_pool, (pool_destruct_func)g_list_free, params); - st->normalizer = lua_normalizer_func; - st->normalizer_data = params; - return TRUE; -} -#endif - - -gboolean -parse_normalizer (struct config_file *cfg, struct statfile *st, const gchar *line) -{ - gchar *params_begin; - - params_begin = strchr (line, ':'); - if (params_begin == NULL) { - msg_err ("no parameters are specified for normalizer %s", line); - return FALSE; - } - - /* Try to guess normalizer */ - if (g_ascii_strncasecmp (line, "internal", sizeof ("points")) == 0) { - return parse_internal_normalizer (cfg, st, params_begin + 1); - } -#ifdef WITH_LUA - else if (g_ascii_strncasecmp (line, "points", sizeof ("points")) == 0) { - return parse_lua_normalizer (cfg, st, params_begin + 1); - } -#endif - - msg_err ("unknown normalizer %s", line); - return FALSE; -} - static GMarkupParser xml_parser = { .start_element = rspamd_xml_start_element, .end_element = rspamd_xml_end_element, |