[master] d879bd3a8 Flexelint-polish of Generalize the VDP API

Nils Goroll nils.goroll at uplex.de
Mon Sep 2 15:30:06 UTC 2024


commit d879bd3a8262f02aae79992de375beafd2614b6b
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon Sep 2 17:22:35 2024 +0200

    Flexelint-polish of Generalize the VDP API

diff --git a/bin/varnishd/cache/cache_deliver_proc.c b/bin/varnishd/cache/cache_deliver_proc.c
index db658d17b..5321fa06c 100644
--- a/bin/varnishd/cache/cache_deliver_proc.c
+++ b/bin/varnishd/cache/cache_deliver_proc.c
@@ -71,14 +71,12 @@ VDP_Fini(const struct vdp_ctx *vdc)
 
 void
 VDP_Init(struct vdp_ctx *vdc, struct worker *wrk, struct vsl_log *vsl,
-    struct req *req, struct busyobj *bo, intmax_t *clen)
+    const struct req *req, const struct busyobj *bo, intmax_t *clen)
 {
 	AN(vdc);
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 	AN(vsl);
 
-	CHECK_OBJ_ORNULL(req, REQ_MAGIC);
-	CHECK_OBJ_ORNULL(bo, BUSYOBJ_MAGIC);
 	AN(clen);
 
 	assert((req ? 1 : 0) ^ (bo ? 1 : 0));
@@ -93,10 +91,12 @@ VDP_Init(struct vdp_ctx *vdc, struct worker *wrk, struct vsl_log *vsl,
 	vdc->clen = clen;
 
 	if (req != NULL) {
+		CHECK_OBJ(req, REQ_MAGIC);
 		vdc->oc = req->objcore;
 		vdc->hp = req->resp;
 	}
 	else {
+		CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
 		vdc->oc = bo->bereq_body;
 		vdc->hp = bo->bereq;
 	}
diff --git a/bin/varnishd/cache/cache_varnishd.h b/bin/varnishd/cache/cache_varnishd.h
index 804961493..e0b88b4aa 100644
--- a/bin/varnishd/cache/cache_varnishd.h
+++ b/bin/varnishd/cache/cache_varnishd.h
@@ -193,7 +193,7 @@ void VDI_Init(void);
 /* cache_deliver_proc.c */
 void VDP_Fini(const struct vdp_ctx *vdc);
 void VDP_Init(struct vdp_ctx *vdc, struct worker *wrk, struct vsl_log *vsl,
-    struct req *req, struct busyobj *bo, intmax_t *cl);
+    const struct req *req, const struct busyobj *bo, intmax_t *cl);
 uint64_t VDP_Close(struct vdp_ctx *, struct objcore *, struct boc *);
 void VDP_Panic(struct vsb *vsb, const struct vdp_ctx *vdc);
 int VDP_Push(VRT_CTX, struct vdp_ctx *, struct ws *, const struct vdp *,
diff --git a/bin/varnishd/cache/cache_vrt_filter.c b/bin/varnishd/cache/cache_vrt_filter.c
index 702026a47..40236fd9b 100644
--- a/bin/varnishd/cache/cache_vrt_filter.c
+++ b/bin/varnishd/cache/cache_vrt_filter.c
@@ -282,7 +282,7 @@ VCL_StackVDP(struct vdp_ctx *vdc, const struct vcl *vcl, const char *fl,
 		if (vp == NULL)
 			return (0);
 		if (vp == vfilter_error) {
-			VSLb(req->vsl, SLT_Error,
+			VSLb(ctx->vsl, SLT_Error,
 			    "Filter '...%s' not found", fl);
 			return (-1);
 		}


More information about the varnish-commit mailing list