[master] 40460fe90 Change the 'len' field in vmod_priv and vrt_blob to a 'long'

Poul-Henning Kamp phk at FreeBSD.org
Tue Feb 5 06:36:10 UTC 2019


commit 40460fe90aa27b3aea93e7bd560c3ebe11f3f9ec
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Feb 5 06:33:34 2019 +0000

    Change the 'len' field in vmod_priv and vrt_blob to a 'long'
    
    We have code which relies on it being able to contain negative
    values as error indications, but 'ssize_t' from unistd.h is a bridge
    too far for vrt.h which is meant to be _incredibly_ portable to
    avoid problems at compile time.

diff --git a/bin/varnishd/cache/cache_vrt_priv.c b/bin/varnishd/cache/cache_vrt_priv.c
index 13ab454e2..fe9da5d77 100644
--- a/bin/varnishd/cache/cache_vrt_priv.c
+++ b/bin/varnishd/cache/cache_vrt_priv.c
@@ -68,7 +68,7 @@ pan_privs(struct vsb *vsb, const struct vrt_privs *privs)
 		VRBT_FOREACH(vp, vrt_priv_tree, &privs->privs) {
 			PAN_CheckMagic(vsb, vp, VRT_PRIV_MAGIC);
 			VSB_printf(vsb,
-			    "priv {p %p l %d f %p} vmod %jx\n",
+			    "priv {p %p l %ld f %p} vmod %jx\n",
 			    vp->priv->priv,
 			    vp->priv->len,
 			    vp->priv->free,
diff --git a/include/vrt.h b/include/vrt.h
index 4b547e839..2e4ed2301 100644
--- a/include/vrt.h
+++ b/include/vrt.h
@@ -53,6 +53,7 @@
  *
  *
  * 9.0 (scheduled for 2019-03-15)
+ *	Make 'len' in vmod_priv and vrt_blob a 'long'
  *	HTTP_Copy() removed
  *	HTTP_Dup() added
  *	HTTP_Clone() added
@@ -177,7 +178,7 @@ struct strands {
 
 struct vrt_blob {
 	unsigned	type;
-	size_t		len;
+	long		len;
 	const void	*blob;
 };
 
@@ -531,7 +532,7 @@ typedef int vmod_event_f(VRT_CTX, struct vmod_priv *, enum vcl_event_e);
 typedef void vmod_priv_free_f(void *);
 struct vmod_priv {
 	void			*priv;
-	int			len;
+	long			len;
 	vmod_priv_free_f	*free;
 };
 


More information about the varnish-commit mailing list