From 6e39a49eca6680b95d9ce60db8e85fc29643efbc Mon Sep 17 00:00:00 2001 From: zxlhhyccc <45259624+zxlhhyccc@users.noreply.github.com> Date: Sun, 17 Mar 2024 21:23:45 +0800 Subject: [PATCH] shadowsocksr-libev: Upgrade PCRE2 & drop libopenssl-legacy depends * shadowsocksr-libev: Upgrade PCRE to PCRE2 --- shadowsocksr-libev/src/server/rule.h | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/shadowsocksr-libev/src/server/rule.h b/shadowsocksr-libev/src/server/rule.h index 015bc42b..84a89af6 100644 --- a/shadowsocksr-libev/src/server/rule.h +++ b/shadowsocksr-libev/src/server/rule.h @@ -33,17 +33,27 @@ #include -#ifdef HAVE_PCRE_H -#include -#elif HAVE_PCRE_PCRE_H -#include -#endif +/* + * The PCRE2_CODE_UNIT_WIDTH macro must be defined before including pcre2.h. + * For a program that uses only one code unit width, setting it to 8, 16, or 32 + * makes it possible to use generic function names such as pcre2_compile(). Note + * that just changing 8 to 16 (for example) is not sufficient to convert this + * program to process 16-bit characters. Even in a fully 16-bit environment, where + * string-handling functions such as strcmp() and printf() work with 16-bit + * characters, the code for handling the table of named substrings will still need + * to be modified. + */ +/* we only need to support ASCII chartable, thus set it to 8 */ +#define PCRE2_CODE_UNIT_WIDTH 8 + +#include typedef struct rule { char *pattern; /* Runtime fields */ - pcre *pattern_re; + pcre2_code *pattern_re; + pcre2_match_data *pattern_re_match_data; struct cork_dllist_item entries; } rule_t;