Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-pcre2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-pcre2
Commits
0ef229c5
Commit
0ef229c5
authored
Mar 19, 2017
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace the SET_OPT macro with a static inline function.
parent
699924dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
35 deletions
+39
-35
vmod_pcre2.c
src/vmod_pcre2.c
+39
-35
No files found.
src/vmod_pcre2.c
View file @
0ef229c5
...
...
@@ -57,9 +57,6 @@
#define INIT(ctx) (((ctx)->method & VCL_MET_INIT) != 0)
#define SET_OPT(lval, opt, PCRE2_OPT) \
do { if (opt) (lval) |= (PCRE2_OPT); } while(0)
#define SET_CTX_PARAM(ctx, param, type) do { \
if ((param) != 0) AZ(pcre2_set_##param((ctx), (type)(param))); \
} while(0)
...
...
@@ -138,6 +135,13 @@ report_pcre2_err(VRT_CTX, int errcode, const char * const restrict msg,
WS_Reset
(
ctx
->
ws
,
snap
);
}
static
inline
void
set_opt
(
uint32_t
*
options
,
VCL_BOOL
vmod_opt
,
uint32_t
pcre2_opt
)
{
if
(
vmod_opt
)
*
options
|=
pcre2_opt
;
}
/* Event function */
int
__match_proto__
(
vmod_event_f
)
...
...
@@ -233,31 +237,31 @@ vmod_regex__init(VRT_CTX, struct vmod_pcre2_regex **regexp,
CHECK_UINT32_RANGE
(
parens_nest_limit
,
vcl_name
,
" constructor"
,);
/* XXX check illegal combinations such as never_ucp && ucp ... ? */
SET_OPT
(
options
,
anchored
,
PCRE2_ANCHORED
);
SET_OPT
(
options
,
allow_empty_class
,
PCRE2_ALLOW_EMPTY_CLASS
);
SET_OPT
(
options
,
alt_bsux
,
PCRE2_ALT_BSUX
);
SET_OPT
(
options
,
alt_circumflex
,
PCRE2_ALT_CIRCUMFLEX
);
SET_OPT
(
options
,
alt_verbnames
,
PCRE2_ALT_VERBNAMES
);
SET_OPT
(
options
,
caseless
,
PCRE2_CASELESS
);
SET_OPT
(
options
,
dollar_endonly
,
PCRE2_DOLLAR_ENDONLY
);
SET_OPT
(
options
,
dotall
,
PCRE2_DOTALL
);
SET_OPT
(
options
,
dupnames
,
PCRE2_DUPNAMES
);
SET_OPT
(
options
,
extended
,
PCRE2_EXTENDED
);
SET_OPT
(
options
,
firstline
,
PCRE2_FIRSTLINE
);
SET_OPT
(
options
,
match_unset_backref
,
PCRE2_MATCH_UNSET_BACKREF
);
SET_OPT
(
options
,
multiline
,
PCRE2_MULTILINE
);
SET_OPT
(
options
,
never_backslash_c
,
PCRE2_NEVER_BACKSLASH_C
);
SET_OPT
(
options
,
never_ucp
,
PCRE2_NEVER_UCP
);
SET_OPT
(
options
,
never_utf
,
PCRE2_NEVER_UTF
);
SET_OPT
(
options
,
no_auto_capture
,
PCRE2_NO_AUTO_CAPTURE
);
SET_OPT
(
options
,
no_auto_possess
,
PCRE2_NO_AUTO_POSSESS
);
SET_OPT
(
options
,
no_dotstar_anchor
,
PCRE2_NO_DOTSTAR_ANCHOR
);
SET_OPT
(
options
,
no_start_optimize
,
PCRE2_NO_START_OPTIMIZE
);
SET_OPT
(
options
,
no_utf_check
,
PCRE2_NO_UTF_CHECK
);
SET_OPT
(
options
,
ucp
,
PCRE2_UCP
);
SET_OPT
(
options
,
ungreedy
,
PCRE2_UNGREEDY
);
SET_OPT
(
options
,
use_offset_limit
,
PCRE2_USE_OFFSET_LIMIT
);
SET_OPT
(
options
,
utf
,
PCRE2_UTF
);
set_opt
(
&
options
,
anchored
,
PCRE2_ANCHORED
);
set_opt
(
&
options
,
allow_empty_class
,
PCRE2_ALLOW_EMPTY_CLASS
);
set_opt
(
&
options
,
alt_bsux
,
PCRE2_ALT_BSUX
);
set_opt
(
&
options
,
alt_circumflex
,
PCRE2_ALT_CIRCUMFLEX
);
set_opt
(
&
options
,
alt_verbnames
,
PCRE2_ALT_VERBNAMES
);
set_opt
(
&
options
,
caseless
,
PCRE2_CASELESS
);
set_opt
(
&
options
,
dollar_endonly
,
PCRE2_DOLLAR_ENDONLY
);
set_opt
(
&
options
,
dotall
,
PCRE2_DOTALL
);
set_opt
(
&
options
,
dupnames
,
PCRE2_DUPNAMES
);
set_opt
(
&
options
,
extended
,
PCRE2_EXTENDED
);
set_opt
(
&
options
,
firstline
,
PCRE2_FIRSTLINE
);
set_opt
(
&
options
,
match_unset_backref
,
PCRE2_MATCH_UNSET_BACKREF
);
set_opt
(
&
options
,
multiline
,
PCRE2_MULTILINE
);
set_opt
(
&
options
,
never_backslash_c
,
PCRE2_NEVER_BACKSLASH_C
);
set_opt
(
&
options
,
never_ucp
,
PCRE2_NEVER_UCP
);
set_opt
(
&
options
,
never_utf
,
PCRE2_NEVER_UTF
);
set_opt
(
&
options
,
no_auto_capture
,
PCRE2_NO_AUTO_CAPTURE
);
set_opt
(
&
options
,
no_auto_possess
,
PCRE2_NO_AUTO_POSSESS
);
set_opt
(
&
options
,
no_dotstar_anchor
,
PCRE2_NO_DOTSTAR_ANCHOR
);
set_opt
(
&
options
,
no_start_optimize
,
PCRE2_NO_START_OPTIMIZE
);
set_opt
(
&
options
,
no_utf_check
,
PCRE2_NO_UTF_CHECK
);
set_opt
(
&
options
,
ucp
,
PCRE2_UCP
);
set_opt
(
&
options
,
ungreedy
,
PCRE2_UNGREEDY
);
set_opt
(
&
options
,
use_offset_limit
,
PCRE2_USE_OFFSET_LIMIT
);
set_opt
(
&
options
,
utf
,
PCRE2_UTF
);
SET_CTX_PARAM
(
ccontext
,
max_pattern_length
,
PCRE2_SIZE
);
SET_CTX_PARAM
(
ccontext
,
parens_nest_limit
,
uint32_t
);
...
...
@@ -448,14 +452,14 @@ vmod_regex_match(VRT_CTX, struct vmod_pcre2_regex *regex,
mctx_call
->
priv
=
match_opts
;
mctx_call
->
free
=
match_call_free
;
SET_OPT
(
match_opts
->
options
,
anchored
,
PCRE2_ANCHORED
);
SET_OPT
(
match_opts
->
options
,
notbol
,
PCRE2_NOTBOL
);
SET_OPT
(
match_opts
->
options
,
noteol
,
PCRE2_NOTEOL
);
SET_OPT
(
match_opts
->
options
,
notempty
,
PCRE2_NOTEMPTY
);
SET_OPT
(
match_opts
->
options
,
notempty_atstart
,
set_opt
(
&
match_opts
->
options
,
anchored
,
PCRE2_ANCHORED
);
set_opt
(
&
match_opts
->
options
,
notbol
,
PCRE2_NOTBOL
);
set_opt
(
&
match_opts
->
options
,
noteol
,
PCRE2_NOTEOL
);
set_opt
(
&
match_opts
->
options
,
notempty
,
PCRE2_NOTEMPTY
);
set_opt
(
&
match_opts
->
options
,
notempty_atstart
,
PCRE2_NOTEMPTY_ATSTART
);
SET_OPT
(
match_opts
->
options
,
no_jit
,
PCRE2_NO_JIT
);
SET_OPT
(
match_opts
->
options
,
no_utf_check
,
PCRE2_NO_UTF_CHECK
);
set_opt
(
&
match_opts
->
options
,
no_jit
,
PCRE2_NO_JIT
);
set_opt
(
&
match_opts
->
options
,
no_utf_check
,
PCRE2_NO_UTF_CHECK
);
if
(
partials
!=
NULL
)
{
VERR
(
ctx
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment