diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2021-12-25 01:07:16 +0300 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2021-12-25 01:07:16 +0300 |
commit | 931acbf5bcd550af8613d131f4ba49e22e909efb (patch) | |
tree | 546ca4eff7cdd6918e2efb5283eb60c96c0f30c5 /src/core/ngx_regex.h | |
parent | c6fec0b027569a4e0b1d8aaee7dea0f2e4d6052b (diff) |
PCRE2 and PCRE binary compatibility.
With this change, dynamic modules using nginx regex interface can be used
regardless of the variant of the PCRE library nginx was compiled with.
If a module is compiled with different PCRE library variant, in case of
ngx_regex_exec() errors it will report wrong function name in error
messages. This is believed to be tolerable, given that fixing this will
require interface changes.
Diffstat (limited to 'src/core/ngx_regex.h')
-rw-r--r-- | src/core/ngx_regex.h | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/core/ngx_regex.h b/src/core/ngx_regex.h index 70bd1db9f..74e694d2e 100644 --- a/src/core/ngx_regex.h +++ b/src/core/ngx_regex.h @@ -19,7 +19,6 @@ #include <pcre2.h> #define NGX_REGEX_NO_MATCHED PCRE2_ERROR_NOMATCH /* -1 */ -#define NGX_REGEX_CASELESS PCRE2_CASELESS typedef pcre2_code ngx_regex_t; @@ -28,7 +27,6 @@ typedef pcre2_code ngx_regex_t; #include <pcre.h> #define NGX_REGEX_NO_MATCHED PCRE_ERROR_NOMATCH /* -1 */ -#define NGX_REGEX_CASELESS PCRE_CASELESS typedef struct { pcre *code; @@ -38,10 +36,13 @@ typedef struct { #endif +#define NGX_REGEX_CASELESS 0x00000001 + + typedef struct { ngx_str_t pattern; ngx_pool_t *pool; - ngx_int_t options; + ngx_uint_t options; ngx_regex_t *regex; int captures; @@ -61,19 +62,13 @@ typedef struct { void ngx_regex_init(void); ngx_int_t ngx_regex_compile(ngx_regex_compile_t *rc); -#if (NGX_PCRE2) - ngx_int_t ngx_regex_exec(ngx_regex_t *re, ngx_str_t *s, int *captures, ngx_uint_t size); -#define ngx_regex_exec_n "pcre2_match()" +#if (NGX_PCRE2) +#define ngx_regex_exec_n "pcre2_match()" #else - -#define ngx_regex_exec(re, s, captures, size) \ - pcre_exec(re->code, re->extra, (const char *) (s)->data, (s)->len, 0, 0, \ - captures, size) #define ngx_regex_exec_n "pcre_exec()" - #endif ngx_int_t ngx_regex_exec_array(ngx_array_t *a, ngx_str_t *s, ngx_log_t *log); |