Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-re
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
Nils Goroll
libvmod-re
Commits
9b123dc5
Unverified
Commit
9b123dc5
authored
Oct 26, 2022
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor match() argument to match most of pcre2_match()
This is in preparation for body matching.
parent
6328c0df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
vmod_re.c
src/vmod_re.c
+9
-7
No files found.
src/vmod_re.c
View file @
9b123dc5
...
@@ -157,8 +157,9 @@ vmod_regex__fini(struct vmod_re_regex **rep)
...
@@ -157,8 +157,9 @@ vmod_regex__fini(struct vmod_re_regex **rep)
}
}
static
int
static
int
match
(
VRT_CTX
,
const
vre_t
*
vre
,
VCL_STRING
subject
,
struct
vmod_priv
*
task
,
match
(
VRT_CTX
,
const
vre_t
*
vre
,
VCL_STRING
subject
,
const
struct
vre_limits
*
vre_limits
)
PCRE2_SIZE
length
,
PCRE2_SIZE
startoffset
,
uint32_t
options
,
struct
vmod_priv
*
task
,
const
struct
vre_limits
*
vre_limits
)
{
{
ov_t
*
ov
;
ov_t
*
ov
;
int
i
,
s
=
PCRE2_ERROR_NOMEMORY
,
nov
[
MAX_OV
];
int
i
,
s
=
PCRE2_ERROR_NOMEMORY
,
nov
[
MAX_OV
];
...
@@ -208,8 +209,8 @@ match(VRT_CTX, const vre_t *vre, VCL_STRING subject, struct vmod_priv *task,
...
@@ -208,8 +209,8 @@ match(VRT_CTX, const vre_t *vre, VCL_STRING subject, struct vmod_priv *task,
pcre2_set_match_limit
(
re_ctx
,
vre_limits
->
match
);
pcre2_set_match_limit
(
re_ctx
,
vre_limits
->
match
);
// END unneeded overhead
// END unneeded overhead
s
=
pcre2_match
(
re
,
(
PCRE2_SPTR
)
subject
,
PCRE2_ZERO_TERMINATED
,
0
,
s
=
pcre2_match
(
re
,
(
PCRE2_SPTR
)
subject
,
length
,
startoffset
,
options
,
0
,
data
,
re_ctx
);
data
,
re_ctx
);
if
(
s
<=
PCRE2_ERROR_NOMATCH
)
{
if
(
s
<=
PCRE2_ERROR_NOMATCH
)
{
if
(
s
<
PCRE2_ERROR_PARTIAL
)
if
(
s
<
PCRE2_ERROR_PARTIAL
)
...
@@ -332,8 +333,8 @@ vmod_regex_match(VRT_CTX, struct vmod_re_regex *re, VCL_STRING subject,
...
@@ -332,8 +333,8 @@ vmod_regex_match(VRT_CTX, struct vmod_re_regex *re, VCL_STRING subject,
AN
(
task
);
AN
(
task
);
task
->
len
=
0
;
task
->
len
=
0
;
return
(
match
(
ctx
,
re
->
vre
,
subject
,
task
,
return
(
match
(
ctx
,
re
->
vre
,
subject
,
PCRE2_ZERO_TERMINATED
,
0
,
0
,
get_limits
(
re
,
&
buf
,
limit
,
limit_recursion
))
task
,
get_limits
(
re
,
&
buf
,
limit
,
limit_recursion
))
>
PCRE2_ERROR_NOMATCH
);
>
PCRE2_ERROR_NOMATCH
);
}
}
...
@@ -390,7 +391,8 @@ vmod_match_dyn(VRT_CTX, struct vmod_priv *task, VCL_STRING pattern,
...
@@ -390,7 +391,8 @@ vmod_match_dyn(VRT_CTX, struct vmod_priv *task, VCL_STRING pattern,
return
0
;
return
0
;
}
}
dyn_return
=
(
match
(
ctx
,
vre
,
subject
,
task
,
&
limits
)
dyn_return
=
(
match
(
ctx
,
vre
,
subject
,
PCRE2_ZERO_TERMINATED
,
0
,
0
,
task
,
&
limits
)
>
PCRE2_ERROR_NOMATCH
);
>
PCRE2_ERROR_NOMATCH
);
VRE_free
(
&
vre
);
VRE_free
(
&
vre
);
...
...
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