commit b6b2789: [Minor] Fix multipattern usage

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Aug 4 14:35:06 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-08-04 10:31:01 +0100
URL: https://github.com/rspamd/rspamd/commit/b6b2789ddd1800b087790a4e873078e489a06bfd

[Minor] Fix multipattern usage

---
 src/libmime/lang_detection.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/libmime/lang_detection.c b/src/libmime/lang_detection.c
index 9936bedfa..ba638982d 100644
--- a/src/libmime/lang_detection.c
+++ b/src/libmime/lang_detection.c
@@ -477,17 +477,15 @@ rspamd_language_detector_read_file (struct rspamd_config *cfg,
 				gsize wlen;
 				const char *word = ucl_object_tolstring (w, &wlen);
 				const char *saved;
+				guint mp_flags = RSPAMD_MULTIPATTERN_ICASE|RSPAMD_MULTIPATTERN_UTF8;
+
+				if (rspamd_multipattern_has_hyperscan ()) {
+					mp_flags |= RSPAMD_MULTIPATTERN_RE;
+				}
 
-#ifdef WITH_HYPERSCAN
-				rspamd_multipattern_add_pattern_len (d->stop_words[cat].mp,
-						word, wlen,
-						RSPAMD_MULTIPATTERN_ICASE|RSPAMD_MULTIPATTERN_UTF8
-						|RSPAMD_MULTIPATTERN_RE);
-#else
 				rspamd_multipattern_add_pattern_len (d->stop_words[cat].mp,
 						word, wlen,
-						RSPAMD_MULTIPATTERN_ICASE|RSPAMD_MULTIPATTERN_UTF8);
-#endif
+						mp_flags);
 				nelt->stop_words ++;
 				nstop ++;
 


More information about the Commits mailing list