diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-07-28 15:47:51 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-07-28 15:47:51 +0100 |
commit | 0e21da4e3833d702db12e4129926d7918a1ac527 (patch) | |
tree | 70a65482b883c20bfe53655c8f83ec7f07c2cf16 /src/libutil | |
parent | a95c5a23edaddafa96a9c62da4d541abc680b2c5 (diff) | |
download | rspamd-0e21da4e3833d702db12e4129926d7918a1ac527.tar.gz rspamd-0e21da4e3833d702db12e4129926d7918a1ac527.zip |
[Project] Add `L` flag for regexps to save start of the match in Hyperscan
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/regexp.c | 4 | ||||
-rw-r--r-- | src/libutil/regexp.h | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/libutil/regexp.c b/src/libutil/regexp.c index 396da80d1..ce764a893 100644 --- a/src/libutil/regexp.c +++ b/src/libutil/regexp.c @@ -406,6 +406,10 @@ rspamd_regexp_new (const gchar *pattern, const gchar *flags, /* We optimize all regexps by default */ rspamd_flags |= RSPAMD_REGEXP_FLAG_NOOPT; break; + case 'L': + /* SOM_LEFTMOST hyperscan flag */ + rspamd_flags |= RSPAMD_REGEXP_FLAG_LEFTMOST; + break; case 'r': rspamd_flags |= RSPAMD_REGEXP_FLAG_RAW; rspamd_flags &= ~RSPAMD_REGEXP_FLAG_UTF; diff --git a/src/libutil/regexp.h b/src/libutil/regexp.h index 2e414892a..128edd761 100644 --- a/src/libutil/regexp.h +++ b/src/libutil/regexp.h @@ -34,6 +34,7 @@ #define RSPAMD_REGEXP_FLAG_PCRE_ONLY (1 << 4) #define RSPAMD_REGEXP_FLAG_DISABLE_JIT (1 << 5) #define RSPAMD_REGEXP_FLAG_UTF (1 << 6) +#define RSPAMD_REGEXP_FLAG_LEFTMOST (1 << 7) #ifdef __cplusplus |