Commit 9efdb805 authored by Geoff Simmons's avatar Geoff Simmons

changes in the #include order and WS_* interface

required by recent changes in Varnish trunk
parent 2008044a
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment