aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/re_cache.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-09 12:39:35 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-09 12:39:35 +0000
commit1b40acf053c02093b4fc650463c2ff4e4889e51b (patch)
treeacdd83c376548b005e12d7015a42a30a855beb4f /src/libserver/re_cache.c
parentcbb129cba4aa367757fb0e0962ef6287b2ddd8c5 (diff)
downloadrspamd-1b40acf053c02093b4fc650463c2ff4e4889e51b.tar.gz
rspamd-1b40acf053c02093b4fc650463c2ff4e4889e51b.zip
Pcre2 compilation support
Diffstat (limited to 'src/libserver/re_cache.c')
-rw-r--r--src/libserver/re_cache.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c
index 4ab86937f..a25f0d1e5 100644
--- a/src/libserver/re_cache.c
+++ b/src/libserver/re_cache.c
@@ -22,11 +22,17 @@
#include "libserver/task.h"
#include "libserver/cfg_file.h"
#include "libutil/util.h"
+#include "libutil/regexp.h"
#ifdef WITH_HYPERSCAN
#include "hs.h"
#include "unix-std.h"
#include <signal.h>
+
+#ifndef WITH_PCRE2
#include <pcre.h>
+#else
+#include <pcre2.h>
+#endif
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
@@ -1129,17 +1135,22 @@ rspamd_re_cache_compile_hyperscan (struct rspamd_re_cache *cache,
}
hs_flags[i] = 0;
-
- if (pcre_flags & PCRE_UTF8) {
+#ifndef WITH_PCRE2
+ if (pcre_flags & PCRE_FLAG(UTF8)) {
hs_flags[i] |= HS_FLAG_UTF8;
}
- if (pcre_flags & PCRE_CASELESS) {
+#else
+ if (pcre_flags & PCRE_FLAG(UTF)) {
+ hs_flags[i] |= HS_FLAG_UTF8;
+ }
+#endif
+ if (pcre_flags & PCRE_FLAG(CASELESS)) {
hs_flags[i] |= HS_FLAG_CASELESS;
}
- if (pcre_flags & PCRE_MULTILINE) {
+ if (pcre_flags & PCRE_FLAG(MULTILINE)) {
hs_flags[i] |= HS_FLAG_MULTILINE;
}
- if (pcre_flags & PCRE_DOTALL) {
+ if (pcre_flags & PCRE_FLAG(DOTALL)) {
hs_flags[i] |= HS_FLAG_DOTALL;
}
if (rspamd_regexp_get_maxhits (re) == 1) {