Commit 5ed09a7a authored by Geoff Simmons's avatar Geoff Simmons

minor cosmetic pointer cleanup

parent 9a2b0ae3
...@@ -192,6 +192,7 @@ VCL_STRING __match_proto__() ...@@ -192,6 +192,7 @@ VCL_STRING __match_proto__()
vmod_regex_backref(const struct vrt_ctx *ctx, struct vmod_re_regex *re, vmod_regex_backref(const struct vrt_ctx *ctx, struct vmod_re_regex *re,
VCL_INT refnum, VCL_STRING fallback) VCL_INT refnum, VCL_STRING fallback)
{ {
void *p;
ov_t *ov; ov_t *ov;
char *substr; char *substr;
unsigned l; unsigned l;
...@@ -208,18 +209,17 @@ vmod_regex_backref(const struct vrt_ctx *ctx, struct vmod_re_regex *re, ...@@ -208,18 +209,17 @@ vmod_regex_backref(const struct vrt_ctx *ctx, struct vmod_re_regex *re,
return fallback; return fallback;
} }
ov = (ov_t *) pthread_getspecific(re->ovk); p = pthread_getspecific(re->ovk);
if (ov == NULL) { if (p == NULL) {
VSLb(ctx->vsl, SLT_VCL_Error, VSLb(ctx->vsl, SLT_VCL_Error,
"vmod re: backref called without prior match"); "vmod re: backref called without prior match");
return fallback; return fallback;
} }
if ((void *) ov == match_failed) if (p == match_failed)
return fallback; return fallback;
CHECK_OBJ(ov, OV_MAGIC); CAST_OBJ(ov, p, OV_MAGIC);
assert((char *)ov >= ctx->ws->s && (char *)ov < ctx->ws->e); assert((char *)ov >= ctx->ws->s && (char *)ov < ctx->ws->e);
AN(ov->subject);
assert(ov->subject >= ctx->ws->s && ov->subject < ctx->ws->e); assert(ov->subject >= ctx->ws->s && ov->subject < ctx->ws->e);
assert(ov->count > 0 && ov->count <= MAX_MATCHES); assert(ov->count > 0 && ov->count <= MAX_MATCHES);
...@@ -239,7 +239,7 @@ vmod_regex_backref(const struct vrt_ctx *ctx, struct vmod_re_regex *re, ...@@ -239,7 +239,7 @@ vmod_regex_backref(const struct vrt_ctx *ctx, struct vmod_re_regex *re,
WS_Release(ctx->ws, 0); WS_Release(ctx->ws, 0);
return fallback; return fallback;
} }
assert(len <= strlen(ov->subject + ov->ovector[refnum]) + 1); assert(len <= strlen(ov->subject + ov->ovector[refnum]));
memcpy(substr, ov->subject + ov->ovector[refnum], len); memcpy(substr, ov->subject + ov->ovector[refnum], len);
substr[len] = '\0'; substr[len] = '\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