]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Remove redundant function
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 8 Apr 2017 08:06:27 +0000 (09:06 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 8 Apr 2017 08:06:27 +0000 (09:06 +0100)
src/libmime/filter.c
src/libserver/cfg_rcl.c
src/libserver/cfg_utils.c
src/libutil/str_util.c
src/libutil/str_util.h

index 8b8ddf309b55f172f6f6363ad299534921bf4f73..d6c5508241242bd1cbace23ec99f2f91d67d857b 100644 (file)
@@ -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];
index e4a528e8de31b91fdbec06112e4c49bf1cf00beb..87b2dd0fa45b9c9dcba07ea7c7d3d9e670527180 100644 (file)
@@ -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 {
index 2541c1aace78af948b8cdf8ab5779039e8ef1b30..23d38bc0cadd32c173a624cd948b6f1009fc5aca 100644 (file)
@@ -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;
                }
 
index 595eca2f62b1b80479dfd18df5c6c50e2e9227db..e1f0d53694e651131f846fe466592c3fdc442a0a 100644 (file)
@@ -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
  */
index 2a213d738ff45d0fb432bd971ce1bb4aa3a80573..2fec4298793ecf6460ae45b49002d081364c93c6 100644 (file)
@@ -85,11 +85,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
  */