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
cd2b0621
Commit
cd2b0621
authored
Jun 29, 2017
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The match() and sub() functions re-use code to get call-scoped match contexts.
parent
9c1a7cdb
Pipeline
#258
skipped
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
52 deletions
+17
-52
vmod_pcre2.c
src/vmod_pcre2.c
+17
-52
No files found.
src/vmod_pcre2.c
View file @
cd2b0621
...
...
@@ -940,32 +940,18 @@ vmod_match(VRT_CTX, struct vmod_priv *call, struct vmod_priv *task,
/* Compile and match options saved in PRIV_CALL scope */
/* XXX need a lock */
if
(
call
->
priv
==
NULL
)
{
pcre2_compile_context
*
cctx
;
pcre2_match_context
*
mctx
;
if
((
cctx
=
get_compile_context
(
ctx
,
COMPILE_CTX_PARAMS
,
"pcre2"
,
".match()"
))
==
NULL
)
return
0
;
if
((
mctx
=
get_match_context
(
ctx
,
MATCH_CTX_PARAMS
,
"pcre2"
,
".match()"
))
==
NULL
)
match_call
=
get_match_opts
(
ctx
,
call
,
MATCH_CTX_PARAMS
,
MATCH_FLAGS_PARAMS
,
"pcre2"
,
".match()"
);
if
(
match_call
==
NULL
)
return
0
;
ALLOC_OBJ
(
match_call
,
VMOD_PCRE2_MATCH_CALL_MAGIC
);
if
(
match_call
==
NULL
)
{
ERRNOMEM
(
ctx
,
"allocating call-scoped options in "
"regex.match()"
);
if
(
match_call
->
cctx
==
NULL
)
{
match_call
->
cctx
=
get_compile_context
(
ctx
,
COMPILE_CTX_PARAMS
,
"pcre2"
,
".match()"
);
if
(
match_call
->
cctx
==
NULL
)
return
0
;
}
call
->
priv
=
match_call
;
call
->
free
=
match_call_free
;
match_call
->
cctx
=
cctx
;
match_call
->
mctx
=
mctx
;
set_compile_flags
(
&
match_call
->
compile_options
,
COMPILE_FLAGS_PARAMS
);
set_match_flags
(
&
match_call
->
match_options
,
MATCH_FLAGS_PARAMS
);
}
else
CAST_OBJ
(
match_call
,
call
->
priv
,
VMOD_PCRE2_MATCH_CALL_MAGIC
);
if
((
code
=
compile
(
ctx
,
match_call
->
cctx
,
pattern
,
match_call
->
compile_options
,
have_jit
&&
!
no_jit
,
...
...
@@ -1064,39 +1050,18 @@ vmod_sub(VRT_CTX, struct vmod_priv *priv_call, struct vmod_priv *priv_task,
return
NULL
;
}
if
(
priv_call
->
priv
==
NULL
)
{
pcre2_compile_context
*
cctx
;
pcre2_match_context
*
mctx
;
if
((
cctx
=
get_compile_context
(
ctx
,
COMPILE_CTX_PARAMS
,
"pcre2"
,
".match()"
))
==
NULL
)
return
NULL
;
if
((
mctx
=
get_match_context
(
ctx
,
MATCH_CTX_PARAMS
,
"pcre2"
,
".sub()"
))
==
NULL
)
return
NULL
;
ALLOC_OBJ
(
match_opts
,
VMOD_PCRE2_MATCH_CALL_MAGIC
);
AN
(
match_opts
);
match_opts
->
cctx
=
cctx
;
match_opts
->
mctx
=
mctx
;
priv_call
->
priv
=
match_opts
;
priv_call
->
free
=
match_call_free
;
match_opts
=
get_match_opts
(
ctx
,
priv_call
,
MATCH_CTX_PARAMS
,
MATCH_SUB_FLAGS_PARAMS
,
"pcre2"
,
".sub()"
);
if
(
match_opts
==
NULL
)
return
0
;
if
(
match_opts
->
cctx
==
NULL
)
{
match_opts
->
cctx
=
get_compile_context
(
ctx
,
COMPILE_CTX_PARAMS
,
"pcre2"
,
".sub()"
);
if
(
match_opts
->
cctx
==
NULL
)
return
0
;
set_compile_flags
(
&
match_opts
->
compile_options
,
COMPILE_FLAGS_PARAMS
);
set_match_flags
(
&
match_opts
->
match_options
,
MATCH_FLAGS_PARAMS
);
set_opt
(
&
match_opts
->
match_options
,
suball
,
PCRE2_SUBSTITUTE_GLOBAL
);
set_opt
(
&
match_opts
->
match_options
,
sub_extended
,
PCRE2_SUBSTITUTE_EXTENDED
);
set_opt
(
&
match_opts
->
match_options
,
unknown_unset
,
PCRE2_SUBSTITUTE_UNKNOWN_UNSET
);
set_opt
(
&
match_opts
->
match_options
,
unset_empty
,
PCRE2_SUBSTITUTE_UNSET_EMPTY
);
}
else
CAST_OBJ
(
match_opts
,
priv_call
->
priv
,
VMOD_PCRE2_MATCH_CALL_MAGIC
);
if
((
code
=
compile
(
ctx
,
match_opts
->
cctx
,
pattern
,
match_opts
->
compile_options
,
have_jit
&&
!
no_jit
,
...
...
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