[master] 86af5ce09 actually, the scope must not change either

Nils Goroll nils.goroll at uplex.de
Tue Oct 30 17:02:08 UTC 2018


commit 86af5ce095a6e39e313cf7c6c23a49edba4aace6
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Tue Oct 30 17:58:46 2018 +0100

    actually, the scope must not change either
    
    the priv id is basically equivalent to the head (struct vrt_privs),
    and a vrt privs list thus can not contain privs with another id.
    
    So we could also retire the id member of struct vrt_priv...

diff --git a/bin/varnishd/cache/cache_vrt_priv.c b/bin/varnishd/cache/cache_vrt_priv.c
index e150ee4ac..754605146 100644
--- a/bin/varnishd/cache/cache_vrt_priv.c
+++ b/bin/varnishd/cache/cache_vrt_priv.c
@@ -42,7 +42,7 @@ struct vrt_priv {
 	VTAILQ_ENTRY(vrt_priv)		list;
 	struct vmod_priv		priv[1];
 	const struct vcl		*vcl;
-	uintptr_t			id;
+	uintptr_t			id;	// = scope / vrt_privs
 	uintptr_t			vmod_id;
 };
 
@@ -102,8 +102,9 @@ vrt_priv_dynamic(const struct vcl *vcl, struct ws *ws,
 
 	VTAILQ_FOREACH(vp, &vps->privs, list) {
 		CHECK_OBJ_NOTNULL(vp, VRT_PRIV_MAGIC);
-		if (vp->id == id && vp->vmod_id == vmod_id) {
+		if (vp->vmod_id == vmod_id) {
 			assert(vp->vcl == vcl);
+			assert(vp->id == id);
 			return (vp->priv);
 		}
 	}


More information about the varnish-commit mailing list