aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-08 09:06:27 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-08 09:06:27 +0100
commit8ee3c686bae135d6b20de1ed484600c1a637048c (patch)
treed4b3e3fc247202aca44d683facea2ffea73199d0
parent2e5dae850516f923cda3b26492c697a676aa3cdc (diff)
downloadrspamd-8ee3c686bae135d6b20de1ed484600c1a637048c.tar.gz
rspamd-8ee3c686bae135d6b20de1ed484600c1a637048c.zip
[Minor] Remove redundant function
-rw-r--r--src/libmime/filter.c2
-rw-r--r--src/libserver/cfg_rcl.c8
-rw-r--r--src/libserver/cfg_utils.c6
-rw-r--r--src/libutil/str_util.c24
-rw-r--r--src/libutil/str_util.h5
5 files changed, 8 insertions, 37 deletions
diff --git a/src/libmime/filter.c b/src/libmime/filter.c
index 8b8ddf309..d6c550824 100644
--- a/src/libmime/filter.c
+++ b/src/libmime/filter.c
@@ -382,8 +382,6 @@ rspamd_check_action_metric (struct rspamd_task *task, struct rspamd_metric_resul
}
}
else {
- i = task->pre_result.action;
-
for (i = task->pre_result.action; i < METRIC_ACTION_MAX; i ++) {
selected_action = &mres->metric->actions[i];
sc = mres->actions_limits[i];
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c
index e4a528e8d..87b2dd0fa 100644
--- a/src/libserver/cfg_rcl.c
+++ b/src/libserver/cfg_rcl.c
@@ -1228,12 +1228,12 @@ rspamd_rcl_statfile_handler (rspamd_mempool_t *pool, const ucl_object_t *obj,
msg_info_config (
"statfile %s has no explicit 'spam' setting, trying to guess by symbol",
st->symbol);
- if (rspamd_strncasestr (st->symbol, "spam",
- strlen (st->symbol)) != NULL) {
+ if (rspamd_substring_search_caseless (st->symbol,
+ strlen (st->symbol),"spam", 4) != -1) {
st->is_spam = TRUE;
}
- else if (rspamd_strncasestr (st->symbol, "ham",
- strlen (st->symbol)) != NULL) {
+ else if (rspamd_substring_search_caseless (st->symbol,
+ strlen (st->symbol),"ham", 3) != -1) {
st->is_spam = FALSE;
}
else {
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c
index 2541c1aac..23d38bc0c 100644
--- a/src/libserver/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
@@ -1175,10 +1175,12 @@ rspamd_config_check_statfiles (struct rspamd_classifier_config *cf)
cur = cf->statfiles;
while (cur) {
st = cur->data;
- if (rspamd_strncasestr (st->symbol, "spam", -1) != NULL) {
+ if (rspamd_substring_search_caseless (st->symbol,
+ strlen (st->symbol),"spam", 4) != -1) {
st->is_spam = TRUE;
}
- else if (rspamd_strncasestr (st->symbol, "ham", -1) != NULL) {
+ else if (rspamd_substring_search_caseless (st->symbol,
+ strlen (st->symbol),"ham", 3) != -1) {
st->is_spam = FALSE;
}
diff --git a/src/libutil/str_util.c b/src/libutil/str_util.c
index 595eca2f6..e1f0d5369 100644
--- a/src/libutil/str_util.c
+++ b/src/libutil/str_util.c
@@ -386,30 +386,6 @@ rspamd_strlcpy_tolower (gchar *dst, const gchar *src, gsize siz)
return (s - src - 1); /* count does not include NUL */
}
-
-/*
- * Find the first occurrence of find in s, ignore case.
- */
-gchar *
-rspamd_strncasestr (const gchar *s, const gchar *find, gint len)
-{
- gchar c, sc;
- gsize mlen;
-
- if ((c = *find++) != 0) {
- c = g_ascii_tolower (c);
- mlen = strlen (find);
- do {
- do {
- if ((sc = *s++) == 0 || len-- == 0)
- return (NULL);
- } while (g_ascii_tolower (sc) != c);
- } while (g_ascii_strncasecmp (s, find, mlen) != 0);
- s--;
- }
- return ((gchar *)s);
-}
-
/*
* Try to convert string of length to long
*/
diff --git a/src/libutil/str_util.h b/src/libutil/str_util.h
index 2a213d738..2fec42987 100644
--- a/src/libutil/str_util.h
+++ b/src/libutil/str_util.h
@@ -86,11 +86,6 @@ gsize rspamd_strlcpy (gchar *dst, const gchar *src, gsize siz);
gsize rspamd_strlcpy_tolower (gchar *dst, const gchar *src, gsize siz);
/*
- * Find string find in string s ignoring case
- */
-gchar * rspamd_strncasestr (const gchar *s, const gchar *find, gint len);
-
-/*
* Try to convert string of length to long
*/
gboolean rspamd_strtol (const gchar *s, gsize len, glong *value);