r3060 - in trunk/varnish-cache: bin/varnishtest/tests lib/libvcl

phk at projects.linpro.no phk at projects.linpro.no
Fri Aug 1 14:44:54 CEST 2008


Author: phk
Date: 2008-08-01 14:44:53 +0200 (Fri, 01 Aug 2008)
New Revision: 3060

Modified:
   trunk/varnish-cache/bin/varnishtest/tests/v00007.vtc
   trunk/varnish-cache/lib/libvcl/vcc_dir_random.c
   trunk/varnish-cache/lib/libvcl/vcc_dir_round_robin.c
Log:
The compiler should not care about field order in director decls.



Modified: trunk/varnish-cache/bin/varnishtest/tests/v00007.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/v00007.vtc	2008-08-01 11:24:48 UTC (rev 3059)
+++ trunk/varnish-cache/bin/varnishtest/tests/v00007.vtc	2008-08-01 12:44:53 UTC (rev 3060)
@@ -12,7 +12,7 @@
 varnish v1 -vcl+backend {
 	director foo random {
 		{ .backend = s1; .weight = 1; }
-		{ .backend = s1; .weight = 1; }
+		{ .weight = 1; .backend = s1; }
 	}
 
 	sub vcl_recv {

Modified: trunk/varnish-cache/lib/libvcl/vcc_dir_random.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_dir_random.c	2008-08-01 11:24:48 UTC (rev 3059)
+++ trunk/varnish-cache/lib/libvcl/vcc_dir_random.c	2008-08-01 12:44:53 UTC (rev 3060)
@@ -56,6 +56,7 @@
 	int nbh, nelem;
 	struct fld_spec *fs;
 	unsigned u;
+	const char *first;
 
 	fs = vcc_FldSpec(tl, "!backend", "!weight", NULL);
 
@@ -64,6 +65,7 @@
 	    PF(t_dir));
 
 	for (nelem = 0; tl->t->tok != '}'; nelem++) {	/* List of members */
+		first = "";
 		t_be = tl->t;
 		vcc_ResetFldSpec(fs);
 		nbh = -1;
@@ -78,7 +80,7 @@
 			if (vcc_IdIs(t_field, "backend")) {
 				vcc_ParseBackendHost(tl, &nbh,
 				    t_dir, t_policy, nelem);
-				Fc(tl, 0, " .host = &bh_%d,", nbh);
+				Fc(tl, 0, "%s .host = &bh_%d", first, nbh);
 				ERRCHK(tl);
 			} else if (vcc_IdIs(t_field, "weight")) {
 				ExpectErr(tl, CNUM);
@@ -92,13 +94,14 @@
 					vcc_ErrWhere(tl, tl->t);
 					return;
 				}
-				Fc(tl, 0, " .weight = %u", u);
+				Fc(tl, 0, "%s .weight = %u", first, u);
 				vcc_NextToken(tl);
 				ExpectErr(tl, ';');
 				vcc_NextToken(tl);
 			} else {
 				ErrInternal(tl);
 			}
+			first = ", ";
 		}
 		vcc_FieldsOk(tl, fs);
 		if (tl->err) {

Modified: trunk/varnish-cache/lib/libvcl/vcc_dir_round_robin.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_dir_round_robin.c	2008-08-01 11:24:48 UTC (rev 3059)
+++ trunk/varnish-cache/lib/libvcl/vcc_dir_round_robin.c	2008-08-01 12:44:53 UTC (rev 3060)
@@ -54,6 +54,7 @@
 	struct token *t_field, *t_be;
 	int nbh, nelem;
 	struct fld_spec *fs;
+	const char *first;
 
 	fs = vcc_FldSpec(tl, "!backend", NULL);
 
@@ -62,6 +63,7 @@
 	    PF(t_dir));
 
 	for (nelem = 0; tl->t->tok != '}'; nelem++) {	/* List of members */
+		first = "";
 		t_be = tl->t;
 		vcc_ResetFldSpec(fs);
 		nbh = -1;
@@ -76,11 +78,12 @@
 			if (vcc_IdIs(t_field, "backend")) {
 				vcc_ParseBackendHost(tl, &nbh,
 				    t_dir, t_policy, nelem);
-				Fc(tl, 0, " .host = &bh_%d,", nbh);
+				Fc(tl, 0, "%s .host = &bh_%d", first, nbh);
 				ERRCHK(tl);
 			} else {
 				ErrInternal(tl);
 			}
+			first = ", ";
 		}
 		vcc_FieldsOk(tl, fs);
 		if (tl->err) {




More information about the varnish-commit mailing list