[master] 2215057dd We can't have fun outside the ISO C99 standard

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Nov 14 07:15:06 UTC 2019


commit 2215057dd50959f6697448770e2f77dfd3931b40
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu Nov 14 08:10:31 2019 +0100

    We can't have fun outside the ISO C99 standard
    
    Because someone brought a suncc to a vtest party.

diff --git a/bin/varnishtest/tests/m00000.vtc b/bin/varnishtest/tests/m00000.vtc
index a60147dde..206919fa2 100644
--- a/bin/varnishtest/tests/m00000.vtc
+++ b/bin/varnishtest/tests/m00000.vtc
@@ -152,7 +152,6 @@ varnish v1 -vcl {
 	backend be none;
 
 	C{
-		struct empty { };
 		struct zc {
 			size_t	z;
 			char	c;
@@ -202,11 +201,6 @@ varnish v1 -vcl {
 	}
 
 	sub vcl_synth {
-		C{ SETHDR(empty); }C
-		set resp.http.empty-typesize = vtc.typesize("");
-		set resp.http.empty-match =
-		    (resp.http.empty-sizeof == resp.http.empty-typesize);
-
 		C{ SETHDR(zc); }C
 		set resp.http.zc-typesize = vtc.typesize("zc");
 		set resp.http.zc-match =
diff --git a/lib/libvmod_vtc/vmod_vtc.c b/lib/libvmod_vtc/vmod_vtc.c
index 51a279d27..9370a403e 100644
--- a/lib/libvmod_vtc/vmod_vtc.c
+++ b/lib/libvmod_vtc/vmod_vtc.c
@@ -271,6 +271,7 @@ vmod_typesize(VRT_CTX, VCL_STRING s)
 
 	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
 	AN(s);
+	AN(*s);
 
 	for (; *s; s++) {
 		switch (*s) {
@@ -296,10 +297,8 @@ vmod_typesize(VRT_CTX, VCL_STRING s)
 			i += (l - a); /* align */
 		i += l;
 	}
-	if (i > 0) {
-		a = i % p;
-		if (a != 0)
-			i += (p - a); /* pad */
-	}
+	a = i % p;
+	if (a != 0)
+		i += (p - a); /* pad */
 	return ((VCL_INT)i);
 }


More information about the varnish-commit mailing list