diff options
| author | Sam Varshavchik | 2021-11-28 10:17:28 -0500 | 
|---|---|---|
| committer | Sam Varshavchik | 2021-11-28 10:17:28 -0500 | 
| commit | ba64de5232d3b0124e540124fcded55f8c4d42ab (patch) | |
| tree | 173228a2e920eacd129240909851f6871a135063 /maildir/maildirfilter.c | |
| parent | 00664cc3ece7c29843771561fe2890b635f2b74e (diff) | |
| download | courier-libs-ba64de5232d3b0124e540124fcded55f8c4d42ab.tar.bz2 | |
Convert to PCRE2.
Diffstat (limited to 'maildir/maildirfilter.c')
| -rw-r--r-- | maildir/maildirfilter.c | 35 | 
1 files changed, 16 insertions, 19 deletions
| diff --git a/maildir/maildirfilter.c b/maildir/maildirfilter.c index 82702a1..844b051 100644 --- a/maildir/maildirfilter.c +++ b/maildir/maildirfilter.c @@ -26,13 +26,9 @@  #define	EX_SOFTWARE	70  #endif -#if	HAVE_PCRE_H -#include	<pcre.h> -#else -#if	HAVE_PCRE_PCRE_H -#include	<pcre/pcre.h> -#define HAVE_PCRE_H	1 -#endif +#if	HAVE_PCRE2 +#define PCRE2_CODE_UNIT_WIDTH 8 +#include	<pcre2.h>  #endif  #if	HAVE_SYS_STAT_H @@ -331,24 +327,25 @@ static int maildir_filter_ruleupdate_utf8(struct maildirfilter *r,  			++c;  		} -#if HAVE_PCRE_H +#if HAVE_PCRE2  		switch (type) {  		case contains:  		case startswith:  		case endswith:  			{ -				const char *errptr; -				int errindex; - -				pcre *p=pcre_compile(value, PCRE_UTF8, -						     &errptr, -						     &errindex, -						     0); - - -				if (p == NULL) +				int errcode; +				PCRE2_SIZE errindex; +				pcre2_code *pcre_regexp= +					pcre2_compile((PCRE2_SPTR8)value, +						      PCRE2_ZERO_TERMINATED, +						      PCRE2_UTF, +						      &errcode, +						      &errindex, +						      NULL); + +				if (pcre_regexp == NULL)  					return -1; -				pcre_free(p); +				pcre2_code_free(pcre_regexp);  			}  			break;  		default: | 
