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
uplex-varnish
libvmod-re
Commits
2a771ff7
Unverified
Commit
2a771ff7
authored
Oct 26, 2022
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor out init of the ovector in task->priv
... such that it can optionally be called before match()
parent
9b123dc5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
15 deletions
+26
-15
vmod_re.c
src/vmod_re.c
+26
-15
No files found.
src/vmod_re.c
View file @
2a771ff7
...
...
@@ -156,6 +156,24 @@ vmod_regex__fini(struct vmod_re_regex **rep)
FREE_OBJ
(
re
);
}
static
void
init_task
(
VRT_CTX
,
struct
vmod_priv
*
task
)
{
ov_t
*
ov
;
AZ
(
task
->
priv
);
task
->
priv
=
WS_Alloc
(
ctx
->
ws
,
sizeof
(
*
ov
));
if
(
task
->
priv
==
NULL
)
{
VSLb
(
ctx
->
vsl
,
SLT_VCL_Error
,
"vmod re error: "
"insufficient workspace for backref data"
);
return
;
}
task
->
len
=
-
1
;
AZ
(
task
->
methods
);
ov
=
(
ov_t
*
)
task
->
priv
;
INIT_OBJ
(
ov
,
OV_MAGIC
);
}
static
int
match
(
VRT_CTX
,
const
vre_t
*
vre
,
VCL_STRING
subject
,
PCRE2_SIZE
length
,
PCRE2_SIZE
startoffset
,
uint32_t
options
,
...
...
@@ -173,21 +191,14 @@ match(VRT_CTX, const vre_t *vre, VCL_STRING subject,
if
(
subject
==
NULL
)
subject
=
""
;
if
(
task
->
priv
==
NULL
)
{
if
((
task
->
priv
=
WS_Alloc
(
ctx
->
ws
,
sizeof
(
*
ov
)))
==
NULL
)
{
VSLb
(
ctx
->
vsl
,
SLT_VCL_Error
,
"vmod re error: "
"insufficient workspace for backref data"
);
return
(
s
);
}
task
->
len
=
-
1
;
AZ
(
task
->
methods
);
ov
=
(
ov_t
*
)
task
->
priv
;
ov
->
magic
=
OV_MAGIC
;
}
else
{
AN
(
WS_Allocated
(
ctx
->
ws
,
task
->
priv
,
sizeof
(
*
ov
)));
CAST_OBJ_NOTNULL
(
ov
,
task
->
priv
,
OV_MAGIC
);
}
AN
(
task
);
if
(
task
->
priv
==
NULL
)
init_task
(
ctx
,
task
);
if
(
task
->
priv
==
NULL
)
return
(
s
);
AN
(
WS_Allocated
(
ctx
->
ws
,
task
->
priv
,
sizeof
(
*
ov
)));
CAST_OBJ_NOTNULL
(
ov
,
task
->
priv
,
OV_MAGIC
);
// BEGIN duplication with vre
re
=
VRE_unpack
(
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