diff --git a/bin/varnishd/cache/cache_gzip.c b/bin/varnishd/cache/cache_gzip.c index e7fab9fac1..7e3d245cd9 100644 --- a/bin/varnishd/cache/cache_gzip.c +++ b/bin/varnishd/cache/cache_gzip.c @@ -417,12 +417,9 @@ vdp_gunzip_bytes(struct vdp_ctx *vdc, enum vdp_action act, void **priv, enum vgzret_e vr; ssize_t dl; const void *dp; - struct worker *wrk; struct vgz *vg; CHECK_OBJ_NOTNULL(vdc, VDP_CTX_MAGIC); - wrk = vdc->wrk; - CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); (void)act; CAST_OBJ_NOTNULL(vg, *priv, VGZ_MAGIC); diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c index 23303a60e7..92f8563b3d 100644 --- a/bin/varnishd/cache/cache_hash.c +++ b/bin/varnishd/cache/cache_hash.c @@ -400,7 +400,6 @@ hsh_vry_match(const struct req *req, struct objcore *oc, const uint8_t *vary) static unsigned hsh_rush_match(const struct req *req) { - struct objhead *oh; struct objcore *oc; oc = req->objcore; @@ -416,9 +415,6 @@ hsh_rush_match(const struct req *req) if (req->vcf != NULL) /* NB: must operate under oh lock. */ return (0); - oh = oc->objhead; - CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); - return (hsh_vry_match(req, oc, NULL)); } diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c index c031cb665f..de786162b5 100644 --- a/bin/varnishd/cache/cache_session.c +++ b/bin/varnishd/cache/cache_session.c @@ -675,11 +675,8 @@ void SES_Rel(struct sess *sp) { int i; - struct pool *pp; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - pp = sp->pool; - CHECK_OBJ_NOTNULL(pp, POOL_MAGIC); Lck_Lock(&sp->mtx); assert(sp->refcnt > 0); diff --git a/bin/varnishd/http2/cache_http2_deliver.c b/bin/varnishd/http2/cache_http2_deliver.c index 4013012436..e7ef43fdde 100644 --- a/bin/varnishd/http2/cache_http2_deliver.c +++ b/bin/varnishd/http2/cache_http2_deliver.c @@ -297,7 +297,6 @@ h2_deliver(struct req *req, int sendbody) { size_t sz; const char *r; - struct sess *sp; struct h2_req *r2; struct vsb resp[1]; struct vrt_ctx ctx[1]; @@ -306,8 +305,6 @@ h2_deliver(struct req *req, int sendbody) CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC); CAST_OBJ_NOTNULL(r2, req->transport_priv, H2_REQ_MAGIC); - sp = req->sp; - CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); VSLb(req->vsl, SLT_RespProtocol, "HTTP/2.0"); diff --git a/include/miniobj.h b/include/miniobj.h index dd6f0ca9d2..c986eb8117 100644 --- a/include/miniobj.h +++ b/include/miniobj.h @@ -57,6 +57,7 @@ #define VALID_OBJ(ptr, type_magic) \ ((ptr) != NULL && (ptr)->magic == (type_magic)) +#ifndef NO_CHECK_OBJ #define CHECK_OBJ(ptr, type_magic) \ do { \ assert((ptr)->magic == type_magic); \ @@ -73,6 +74,11 @@ if ((ptr) != NULL) \ assert((ptr)->magic == type_magic); \ } while (0) +#else +#define CHECK_OBJ(ptr, type_magic) (void)0 +#define CHECK_OBJ_NOTNULL(ptr, type_magic) (void)0 +#define CHECK_OBJ_ORNULL(ptr, type_magic) (void)0 +#endif #define CAST_OBJ(to, from, type_magic) \ do { \ diff --git a/vmod/vmod_directors.c b/vmod/vmod_directors.c index 44b98217fe..eed7f60966 100644 --- a/vmod/vmod_directors.c +++ b/vmod/vmod_directors.c @@ -343,7 +343,7 @@ vdir_update_health(VRT_CTX, struct vdir *vd) be = vd->backend[u]; CHECK_OBJ_NOTNULL(be, DIRECTOR_MAGIC); c = 0; - h = VRT_Healthy(ctx, vd->backend[u], &c); + h = VRT_Healthy(ctx, be, &c); if (h) { nh++; tw += vd->weight[u];