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
9efdb805
Commit
9efdb805
authored
Feb 16, 2017
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes in the #include order and WS_* interface
required by recent changes in Varnish trunk
parent
2008044a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
vmod_pcre2.c
src/vmod_pcre2.c
+16
-7
No files found.
src/vmod_pcre2.c
View file @
9efdb805
...
...
@@ -31,10 +31,10 @@
#include <string.h>
#include "vcl.h"
#include "cache/cache.h"
#include "vrt.h"
#include "vas.h"
#include "vdef.h"
#include "cache/cache.h"
#include "vcc_if.h"
...
...
@@ -98,6 +98,12 @@ WS_Allocated(struct ws * const restrict ws, const void * const restrict ptr,
assert
((
char
*
)
ptr
>=
ws
->
s
&&
((
char
*
)
ptr
+
len
)
<=
ws
->
f
);
}
static
inline
char
*
WS_Front
(
struct
ws
*
const
ws
)
{
return
ws
->
f
;
}
/* Event function */
int
__match_proto__
(
vmod_event_f
)
...
...
@@ -285,7 +291,8 @@ vmod_regex__init(VRT_CTX, struct vmod_pcre2_regex **regexp,
code
=
pcre2_compile
((
PCRE2_SPTR
)
pattern
,
PCRE2_ZERO_TERMINATED
,
options
,
&
err_code
,
&
err_offset
,
ccontext
);
if
(
code
==
NULL
)
{
char
*
buf
=
WS_Snapshot
(
ctx
->
ws
);
char
*
buf
=
WS_Front
(
ctx
->
ws
);
uintptr_t
snap
=
WS_Snapshot
(
ctx
->
ws
);
unsigned
bytes
=
WS_Reserve
(
ctx
->
ws
,
0
);
ret
=
pcre2_get_error_message
(
err_code
,
(
PCRE2_UCHAR
*
)
buf
,
(
PCRE2_SIZE
)
bytes
);
...
...
@@ -306,7 +313,7 @@ vmod_regex__init(VRT_CTX, struct vmod_pcre2_regex **regexp,
"at offset %zu"
,
pattern
,
vcl_name
,
buf
,
err_offset
);
}
WS_Reset
(
ctx
->
ws
,
buf
);
WS_Reset
(
ctx
->
ws
,
snap
);
pcre2_compile_context_free
(
ccontext
);
return
;
}
...
...
@@ -317,7 +324,8 @@ vmod_regex__init(VRT_CTX, struct vmod_pcre2_regex **regexp,
ret
=
pcre2_jit_compile
(
code
,
options
);
if
(
ret
!=
0
)
{
/* XXX DRY */
char
*
buf
=
WS_Snapshot
(
ctx
->
ws
);
char
*
buf
=
WS_Front
(
ctx
->
ws
);
uintptr_t
snap
=
WS_Snapshot
(
ctx
->
ws
);
unsigned
bytes
=
WS_Reserve
(
ctx
->
ws
,
0
);
ret
=
pcre2_get_error_message
(
ret
,
(
PCRE2_UCHAR
*
)
buf
,
(
PCRE2_SIZE
)
bytes
);
...
...
@@ -339,7 +347,7 @@ vmod_regex__init(VRT_CTX, struct vmod_pcre2_regex **regexp,
"constructor: %s "
,
pattern
,
vcl_name
,
buf
);
}
WS_Reset
(
ctx
->
ws
,
buf
);
WS_Reset
(
ctx
->
ws
,
snap
);
pcre2_compile_context_free
(
ccontext
);
return
;
}
...
...
@@ -508,7 +516,8 @@ vmod_regex_match(VRT_CTX, struct vmod_pcre2_regex *regex,
return
1
;
/* XXX DRY */
char
*
buf
=
WS_Snapshot
(
ctx
->
ws
);
char
*
buf
=
WS_Front
(
ctx
->
ws
);
uintptr_t
snap
=
WS_Snapshot
(
ctx
->
ws
);
unsigned
bytes
=
WS_Reserve
(
ctx
->
ws
,
0
);
ret
=
pcre2_get_error_message
(
ret
,
(
PCRE2_UCHAR
*
)
buf
,
(
PCRE2_SIZE
)
bytes
);
...
...
@@ -526,7 +535,7 @@ vmod_regex_match(VRT_CTX, struct vmod_pcre2_regex *regex,
WS_Release
(
ctx
->
ws
,
ret
);
VERR
(
ctx
,
"in %s.match(): %s "
,
regex
->
vcl_name
,
buf
);
}
WS_Reset
(
ctx
->
ws
,
buf
);
WS_Reset
(
ctx
->
ws
,
snap
);
return
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