[master] 276ca5e86 Give VDP a proper VDP_Init() function

Poul-Henning Kamp phk at FreeBSD.org
Mon Oct 26 20:07:09 UTC 2020


commit 276ca5e860d436bca8b483b1653b41e0fb989f69
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Oct 26 18:14:31 2020 +0000

    Give VDP a proper VDP_Init() function

diff --git a/bin/varnishd/cache/cache_deliver_proc.c b/bin/varnishd/cache/cache_deliver_proc.c
index 79234e9f3..7ba2450a5 100644
--- a/bin/varnishd/cache/cache_deliver_proc.c
+++ b/bin/varnishd/cache/cache_deliver_proc.c
@@ -34,6 +34,13 @@
 #include "cache_varnishd.h"
 #include "cache_filter.h"
 
+void
+VDP_Init(struct vdp_ctx *vdx)
+{
+	INIT_OBJ(vdx, VDP_CTX_MAGIC);
+	VTAILQ_INIT(&vdx->vdp);
+}
+
 /* VDP_bytes
  *
  * Pushes len bytes at ptr down the delivery processor list.
@@ -57,6 +64,7 @@
  * r == 0: Continue
  * r > 0:  Stop, breaks out early without error condition
  */
+
 int
 VDP_bytes(struct vdp_ctx *vdx, enum vdp_action act, const void *ptr, ssize_t len)
 {
diff --git a/bin/varnishd/cache/cache_filter.h b/bin/varnishd/cache/cache_filter.h
index e106b5c1f..f185171a8 100644
--- a/bin/varnishd/cache/cache_filter.h
+++ b/bin/varnishd/cache/cache_filter.h
@@ -148,6 +148,7 @@ struct vdp_ctx {
 	struct req		*req;
 };
 
+void VDP_Init(struct vdp_ctx *vdx);
 int VDP_bytes(struct vdp_ctx *, enum vdp_action act, const void *ptr, ssize_t len);
 int VDP_Push(struct req *, const struct vdp *, void *priv);
 void VRT_AddVDP(VRT_CTX, const struct vdp *);
diff --git a/bin/varnishd/cache/cache_req.c b/bin/varnishd/cache/cache_req.c
index 0a3bc65a5..7f94d8348 100644
--- a/bin/varnishd/cache/cache_req.c
+++ b/bin/varnishd/cache/cache_req.c
@@ -131,8 +131,7 @@ Req_New(const struct worker *wrk, struct sess *sp)
 	p = (void*)PRNDUP(p + sizeof(*req->htc));
 
 	req->vdc = (void*)p;
-	INIT_OBJ(req->vdc, VDP_CTX_MAGIC);
-	VTAILQ_INIT(&req->vdc->vdp);
+	VDP_Init(req->vdc);
 	p = (void*)PRNDUP(p + sizeof(*req->vdc));
 
 	req->htc = (void*)p;


More information about the varnish-commit mailing list