Refactor match() argument to match most of pcre2_match()

This is in preparation for body matching.
parent 6328c0df
......@@ -157,8 +157,9 @@ vmod_regex__fini(struct vmod_re_regex **rep)
}
static int
match(VRT_CTX, const vre_t *vre, VCL_STRING subject, struct vmod_priv *task,
const struct vre_limits *vre_limits)
match(VRT_CTX, const vre_t *vre, VCL_STRING subject,
PCRE2_SIZE length, PCRE2_SIZE startoffset, uint32_t options,
struct vmod_priv *task, const struct vre_limits *vre_limits)
{
ov_t *ov;
int i, s = PCRE2_ERROR_NOMEMORY, nov[MAX_OV];
......@@ -208,8 +209,8 @@ match(VRT_CTX, const vre_t *vre, VCL_STRING subject, struct vmod_priv *task,
pcre2_set_match_limit(re_ctx, vre_limits->match);
// END unneeded overhead
s = pcre2_match(re, (PCRE2_SPTR)subject, PCRE2_ZERO_TERMINATED, 0,
0, data, re_ctx);
s = pcre2_match(re, (PCRE2_SPTR)subject, length, startoffset, options,
data, re_ctx);
if (s <= PCRE2_ERROR_NOMATCH) {
if (s < PCRE2_ERROR_PARTIAL)
......@@ -332,8 +333,8 @@ vmod_regex_match(VRT_CTX, struct vmod_re_regex *re, VCL_STRING subject,
AN(task);
task->len = 0;
return (match(ctx, re->vre, subject, task,
get_limits(re, &buf, limit, limit_recursion))
return (match(ctx, re->vre, subject, PCRE2_ZERO_TERMINATED, 0, 0,
task, get_limits(re, &buf, limit, limit_recursion))
> PCRE2_ERROR_NOMATCH);
}
......@@ -390,7 +391,8 @@ vmod_match_dyn(VRT_CTX, struct vmod_priv *task, VCL_STRING pattern,
return 0;
}
dyn_return = (match(ctx, vre, subject, task, &limits)
dyn_return = (match(ctx, vre, subject, PCRE2_ZERO_TERMINATED, 0, 0,
task, &limits)
> PCRE2_ERROR_NOMATCH);
VRE_free(&vre);
......
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