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