[master] 714774d Make the VSL_TAG macro responsible for casting

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Tue May 2 10:06:05 CEST 2017


commit 714774d3ef58b4032f28ee7d60986eb9c9052ff1
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Tue May 2 10:03:50 2017 +0200

    Make the VSL_TAG macro responsible for casting

diff --git a/include/vapi/vsl_int.h b/include/vapi/vsl_int.h
index c28604d..bfc24e5 100644
--- a/include/vapi/vsl_int.h
+++ b/include/vapi/vsl_int.h
@@ -70,7 +70,7 @@
 #define VSL_END(ptr, len)	((ptr) + 2 + VSL_WORDS(len))
 #define VSL_NEXT(ptr)		VSL_END(ptr, VSL_LEN(ptr))
 #define VSL_LEN(ptr)		((ptr)[0] & VSL_LENMASK)
-#define VSL_TAG(ptr)		((ptr)[0] >> 24)
+#define VSL_TAG(ptr)		((enum VSL_tag_e)((ptr)[0] >> 24))
 #define VSL_ID(ptr)		(((ptr)[1]) & VSL_IDENTMASK)
 #define VSL_CLIENT(ptr)		(((ptr)[1]) & VSL_CLIENTMARKER)
 #define VSL_BACKEND(ptr)	(((ptr)[1]) & VSL_BACKENDMARKER)
diff --git a/lib/libvarnishapi/vsl.c b/lib/libvarnishapi/vsl.c
index b418c64..2566561 100644
--- a/lib/libvarnishapi/vsl.c
+++ b/lib/libvarnishapi/vsl.c
@@ -172,7 +172,7 @@ vsl_match_IX(struct VSL_data *vsl, const vslf_list *list,
 	const struct vslf *vslf;
 
 	(void)vsl;
-	tag = (enum VSL_tag_e)VSL_TAG(c->rec.ptr);
+	tag = VSL_TAG(c->rec.ptr);
 	cdata = VSL_CDATA(c->rec.ptr);
 	len = VSL_LEN(c->rec.ptr);
 
@@ -194,7 +194,7 @@ VSL_Match(struct VSL_data *vsl, const struct VSL_cursor *c)
 	CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC);
 	if (c == NULL || c->rec.ptr == NULL)
 		return (0);
-	tag = (enum VSL_tag_e)VSL_TAG(c->rec.ptr);
+	tag = VSL_TAG(c->rec.ptr);
 	if (tag <= SLT__Bogus || tag >= SLT__Reserved)
 		return (0);
 	if (vsl->c_opt && !VSL_CLIENT(c->rec.ptr))
@@ -245,7 +245,7 @@ VSL_Print(const struct VSL_data *vsl, const struct VSL_cursor *c, void *fo)
 		return (0);
 	if (fo == NULL)
 		fo = stdout;
-	tag = (enum VSL_tag_e)VSL_TAG(c->rec.ptr);
+	tag = VSL_TAG(c->rec.ptr);
 	vxid = VSL_ID(c->rec.ptr);
 	len = VSL_LEN(c->rec.ptr);
 	type = VSL_CLIENT(c->rec.ptr) ? 'c' : VSL_BACKEND(c->rec.ptr) ?
@@ -283,7 +283,7 @@ VSL_PrintTerse(const struct VSL_data *vsl, const struct VSL_cursor *c, void *fo)
 		return (0);
 	if (fo == NULL)
 		fo = stdout;
-	tag = (enum VSL_tag_e)VSL_TAG(c->rec.ptr);
+	tag = VSL_TAG(c->rec.ptr);
 	len = VSL_LEN(c->rec.ptr);
 	data = VSL_CDATA(c->rec.ptr);
 
diff --git a/lib/libvarnishapi/vsl_dispatch.c b/lib/libvarnishapi/vsl_dispatch.c
index e1d633c..a19ce5d 100644
--- a/lib/libvarnishapi/vsl_dispatch.c
+++ b/lib/libvarnishapi/vsl_dispatch.c
@@ -861,7 +861,7 @@ vtx_scan(struct VSLQ *vslq, struct vtx *vtx)
 			continue;
 		}
 
-		tag = (enum VSL_tag_e)VSL_TAG(ptr);
+		tag = VSL_TAG(ptr);
 		assert(tag != SLT__Batch);
 
 		switch (tag) {



More information about the varnish-commit mailing list