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
uplex-varnish
libvmod-re2
Commits
af7001b1
Commit
af7001b1
authored
Oct 17, 2017
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the return value from RE2::Set:Add to get the index of a set match.
parent
87c01d5e
Pipeline
#341
skipped
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
5 deletions
+5
-5
vmod_re2.c
src/vmod_re2.c
+1
-2
vre2set.cpp
src/vre2/vre2set.cpp
+2
-2
vre2set.h
src/vre2/vre2set.h
+2
-1
No files found.
src/vmod_re2.c
View file @
af7001b1
...
@@ -623,13 +623,12 @@ vmod_set_add(VRT_CTX, struct vmod_re2_set *set, VCL_STRING pattern,
...
@@ -623,13 +623,12 @@ vmod_set_add(VRT_CTX, struct vmod_re2_set *set, VCL_STRING pattern,
set
->
vcl_name
,
pattern
,
set
->
vcl_name
);
set
->
vcl_name
,
pattern
,
set
->
vcl_name
);
return
;
return
;
}
}
if
((
err
=
vre2set_add
(
set
->
set
,
pattern
))
!=
NULL
)
{
if
((
err
=
vre2set_add
(
set
->
set
,
pattern
,
&
n
))
!=
NULL
)
{
VERR
(
ctx
,
ERR_PREFIX
"Cannot compile '%.40s': %s"
,
VERR
(
ctx
,
ERR_PREFIX
"Cannot compile '%.40s': %s"
,
set
->
vcl_name
,
pattern
,
pattern
,
err
);
set
->
vcl_name
,
pattern
,
pattern
,
err
);
return
;
return
;
}
}
n
=
set
->
npatterns
;
if
(
string
!=
NULL
)
{
if
(
string
!=
NULL
)
{
if
((
set
->
string
=
realloc
(
set
->
string
,
if
((
set
->
string
=
realloc
(
set
->
string
,
(
n
+
1
)
*
(
sizeof
(
char
*
))))
(
n
+
1
)
*
(
sizeof
(
char
*
))))
...
...
src/vre2/vre2set.cpp
View file @
af7001b1
...
@@ -124,11 +124,11 @@ vre2set_init(vre2set **setp, anchor_e anchor, unsigned utf8,
...
@@ -124,11 +124,11 @@ vre2set_init(vre2set **setp, anchor_e anchor, unsigned utf8,
}
}
const
char
*
const
char
*
vre2set_add
(
vre2set
*
set
,
const
char
*
const
pattern
)
vre2set_add
(
vre2set
*
set
,
const
char
*
const
pattern
,
int
*
const
idx
)
{
{
try
{
try
{
string
err
;
string
err
;
if
(
set
->
add
(
pattern
,
&
err
)
==
-
1
)
if
(
(
*
idx
=
set
->
add
(
pattern
,
&
err
))
<
0
)
throw
runtime_error
(
err
);
throw
runtime_error
(
err
);
return
NULL
;
return
NULL
;
}
}
...
...
src/vre2/vre2set.h
View file @
af7001b1
...
@@ -69,7 +69,8 @@ extern "C" {
...
@@ -69,7 +69,8 @@ extern "C" {
unsigned
case_sensitive
,
unsigned
perl_classes
,
unsigned
case_sensitive
,
unsigned
perl_classes
,
unsigned
word_boundary
,
unsigned
one_line
);
unsigned
word_boundary
,
unsigned
one_line
);
const
char
*
vre2set_fini
(
vre2set
**
vre2
);
const
char
*
vre2set_fini
(
vre2set
**
vre2
);
const
char
*
vre2set_add
(
vre2set
*
set
,
const
char
*
pattern
);
const
char
*
vre2set_add
(
vre2set
*
set
,
const
char
*
pattern
,
int
*
const
idx
);
const
char
*
vre2set_compile
(
vre2set
*
set
);
const
char
*
vre2set_compile
(
vre2set
*
set
);
const
char
*
vre2set_match
(
vre2set
*
set
,
const
char
*
subject
,
const
char
*
vre2set_match
(
vre2set
*
set
,
const
char
*
subject
,
int
*
const
match
,
void
*
buf
,
int
*
const
match
,
void
*
buf
,
...
...
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