Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-re2
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-re2
Commits
c91432f1
Commit
c91432f1
authored
Mar 25, 2016
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use the event function to initialize the size of RE2 match data
parent
a438c7b1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
8 deletions
+15
-8
vmod_re2.c
src/vmod_re2.c
+13
-8
vmod_re2.vcc
src/vmod_re2.vcc
+2
-0
No files found.
src/vmod_re2.c
View file @
c91432f1
...
@@ -71,7 +71,6 @@ static char c;
...
@@ -71,7 +71,6 @@ static char c;
static
const
void
*
match_failed
=
(
void
*
)
&
c
;
static
const
void
*
match_failed
=
(
void
*
)
&
c
;
static
size_t
match_sz
;
static
size_t
match_sz
;
static
pthread_once_t
sz_init_once
=
PTHREAD_ONCE_INIT
;
static
void
static
void
errmsg
(
VRT_CTX
,
const
char
*
fmt
,
...)
errmsg
(
VRT_CTX
,
const
char
*
fmt
,
...)
...
@@ -92,12 +91,6 @@ errmsg(VRT_CTX, const char *fmt, ...)
...
@@ -92,12 +91,6 @@ errmsg(VRT_CTX, const char *fmt, ...)
va_end
(
args
);
va_end
(
args
);
}
}
static
void
init_matchsz
(
void
)
{
match_sz
=
vre2_matchsz
();
}
static
void
static
void
free_task_match
(
void
*
p
)
free_task_match
(
void
*
p
)
{
{
...
@@ -231,6 +224,19 @@ namedref(VRT_CTX, vre2 * restrict vre2, VCL_STRING name, VCL_STRING fallback,
...
@@ -231,6 +224,19 @@ namedref(VRT_CTX, vre2 * restrict vre2, VCL_STRING name, VCL_STRING fallback,
#undef ERR_PREFIX
#undef ERR_PREFIX
/* Event function */
int
event
(
VRT_CTX
,
struct
vmod_priv
*
priv
,
enum
vcl_event_e
e
)
{
(
void
)
ctx
;
(
void
)
priv
;
if
(
e
==
VCL_EVENT_LOAD
)
match_sz
=
vre2_matchsz
();
return
0
;
}
VCL_VOID
VCL_VOID
vmod_regex__init
(
const
struct
vrt_ctx
*
ctx
,
struct
vmod_re2_regex
**
rep
,
vmod_regex__init
(
const
struct
vrt_ctx
*
ctx
,
struct
vmod_re2_regex
**
rep
,
const
char
*
vcl_name
,
VCL_STRING
pattern
,
VCL_BOOL
utf8
,
const
char
*
vcl_name
,
VCL_STRING
pattern
,
VCL_BOOL
utf8
,
...
@@ -271,7 +277,6 @@ vmod_regex__init(const struct vrt_ctx *ctx, struct vmod_re2_regex **rep,
...
@@ -271,7 +277,6 @@ vmod_regex__init(const struct vrt_ctx *ctx, struct vmod_re2_regex **rep,
}
}
re
->
never_capture
=
never_capture
;
re
->
never_capture
=
never_capture
;
re
->
vcl_name
=
strdup
(
vcl_name
);
re
->
vcl_name
=
strdup
(
vcl_name
);
AZ
(
pthread_once
(
&
sz_init_once
,
init_matchsz
));
}
}
VCL_VOID
VCL_VOID
...
...
src/vmod_re2.vcc
View file @
c91432f1
...
@@ -9,6 +9,8 @@
...
@@ -9,6 +9,8 @@
$Module re2 3 access the Google RE2 regular expression engine
$Module re2 3 access the Google RE2 regular expression engine
$Event event
$Object regex(STRING pattern, BOOL utf8=0, BOOL posix_syntax=0,
$Object regex(STRING pattern, BOOL utf8=0, BOOL posix_syntax=0,
BOOL longest_match=0, INT max_mem=8388608, BOOL literal=0,
BOOL longest_match=0, INT max_mem=8388608, BOOL literal=0,
BOOL never_nl=0, BOOL dot_nl=0, BOOL never_capture=0,
BOOL never_nl=0, BOOL dot_nl=0, BOOL never_capture=0,
...
...
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