Commit c6901806 authored by Geoff Simmons's avatar Geoff Simmons

Take get_match_opts() out of the fast path entirely.

parent 25beb0c3
Pipeline #262 skipped
......@@ -245,11 +245,6 @@ get_match_opts(VRT_CTX, struct vmod_priv *priv, MATCH_CTX_OPTS, MATCH_FLAGS,
struct match_call *match_opts;
pcre2_match_context *mctx;
if (priv->priv != NULL) {
CAST_OBJ(match_opts, priv->priv, VMOD_PCRE2_MATCH_CALL_MAGIC);
return match_opts;
}
if (!check_uint32_range(ctx, match_limit, "match_limit", context,
caller))
return NULL;
......
......@@ -386,10 +386,13 @@ vmod_regex_match(VRT_CTX, struct vmod_pcre2_regex *regex,
/* The match context and options are PRIV_CALL-scoped. */
/* XXX param to decide whether these should be saved for the call */
match_opts = get_match_opts(ctx, priv_call, MATCH_CTX_PARAMS,
MATCH_FLAGS_PARAMS, regex->vcl_name,
".match()");
if (match_opts == NULL)
if (priv_call->priv != NULL)
CAST_OBJ(match_opts, priv_call->priv,
VMOD_PCRE2_MATCH_CALL_MAGIC);
else if ((match_opts = get_match_opts(ctx, priv_call, MATCH_CTX_PARAMS,
MATCH_FLAGS_PARAMS,
regex->vcl_name, ".match()"))
== NULL)
return 0;
/* The match data block is task-scoped for this object only. */
......@@ -468,11 +471,14 @@ vmod_regex_sub(VRT_CTX, struct vmod_pcre2_regex *regex,
return NULL;
}
match_opts = get_match_opts(ctx, priv_call, MATCH_CTX_PARAMS,
MATCH_SUB_FLAGS_PARAMS, regex->vcl_name,
".match()");
if (match_opts == NULL)
return 0;
if (priv_call->priv != NULL)
CAST_OBJ(match_opts, priv_call->priv,
VMOD_PCRE2_MATCH_CALL_MAGIC);
else if ((match_opts = get_match_opts(ctx, priv_call, MATCH_CTX_PARAMS,
MATCH_SUB_FLAGS_PARAMS,
regex->vcl_name, ".sub()"))
== NULL)
return NULL;
return sub(ctx, subject, replacement, len, priv_task, regex->code,
match_opts, regex->vcl_name);
......@@ -499,9 +505,11 @@ vmod_match(VRT_CTX, struct vmod_priv *call, struct vmod_priv *task,
/* Compile and match options saved in PRIV_CALL scope */
/* XXX need a lock */
match_call = get_match_opts(ctx, call, MATCH_CTX_PARAMS,
MATCH_FLAGS_PARAMS, "pcre2", ".match()");
if (match_call == NULL)
if (call->priv != NULL)
CAST_OBJ(match_call, call->priv, VMOD_PCRE2_MATCH_CALL_MAGIC);
else if ((match_call = get_match_opts(ctx, call, MATCH_CTX_PARAMS,
MATCH_FLAGS_PARAMS, "pcre2",
".match()")) == NULL)
return 0;
if (match_call->cctx == NULL) {
match_call->cctx
......@@ -604,9 +612,12 @@ vmod_sub(VRT_CTX, struct vmod_priv *priv_call, struct vmod_priv *priv_task,
return NULL;
}
match_opts = get_match_opts(ctx, priv_call, MATCH_CTX_PARAMS,
MATCH_SUB_FLAGS_PARAMS, "pcre2", ".sub()");
if (match_opts == NULL)
if (priv_call->priv != NULL)
CAST_OBJ(match_opts, priv_call->priv,
VMOD_PCRE2_MATCH_CALL_MAGIC);
else if ((match_opts = get_match_opts(ctx, priv_call, MATCH_CTX_PARAMS,
MATCH_SUB_FLAGS_PARAMS, "pcre2",
".sub()")) == NULL)
return 0;
if (match_opts->cctx == NULL) {
match_opts->cctx
......
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