r4677 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl

tfheen at varnish-cache.org tfheen at varnish-cache.org
Mon Apr 19 13:10:02 CEST 2010


Author: tfheen
Date: 2010-04-19 13:10:02 +0200 (Mon, 19 Apr 2010)
New Revision: 4677

Modified:
   branches/2.1/
   branches/2.1/varnish-cache/bin/varnishd/cache_backend.h
   branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c
   branches/2.1/varnish-cache/bin/varnishd/vparam.h
   branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc
   branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc
   branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc
   branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc
   branches/2.1/varnish-cache/include/vct.h
   branches/2.1/varnish-cache/include/vev.h
   branches/2.1/varnish-cache/lib/libvarnish/tcp.c
   branches/2.1/varnish-cache/lib/libvarnish/vev.c
   branches/2.1/varnish-cache/lib/libvcl/vcc_acl.c
   branches/2.1/varnish-cache/lib/libvcl/vcc_action.c
   branches/2.1/varnish-cache/lib/libvcl/vcc_backend.c
   branches/2.1/varnish-cache/lib/libvcl/vcc_backend_util.c
   branches/2.1/varnish-cache/lib/libvcl/vcc_compile.h
   branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c
   branches/2.1/varnish-cache/lib/libvcl/vcc_dir_round_robin.c
   branches/2.1/varnish-cache/lib/libvcl/vcc_parse.c
Log:
Merge r4649: Add a SkipToken() macro which does a ExpectErr() + vcc_NextToken().




Property changes on: branches/2.1
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk:4637,4640,4643-4645,4647-4648
   + /trunk:4637,4640,4643-4645,4647-4649


Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4648
   + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4649


Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4648
   + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4649


Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4648
   + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4649


Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4648
   + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4649


Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4648
   + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4649


Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4648
   + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4649


Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4648
   + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4649


Property changes on: branches/2.1/varnish-cache/include/vct.h
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4648
   + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4649


Property changes on: branches/2.1/varnish-cache/include/vev.h
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4648
   + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4649


Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4648
   + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4649


Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4648
   + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4649

Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_acl.c
===================================================================
--- branches/2.1/varnish-cache/lib/libvcl/vcc_acl.c	2010-04-19 11:04:19 UTC (rev 4676)
+++ branches/2.1/varnish-cache/lib/libvcl/vcc_acl.c	2010-04-19 11:10:02 UTC (rev 4677)
@@ -309,10 +309,8 @@
 		vcc_NextToken(tl);
 	}
 
-	if (ae->para) {
-		ExpectErr(tl, ')');
-		vcc_NextToken(tl);
-	}
+	if (ae->para) 
+		SkipToken(tl, ')');
 
 	if (!vcc_acl_try_netnotation(tl, ae)) {
 		ERRCHK(tl);
@@ -504,17 +502,14 @@
 	vcc_AddDef(tl, an, R_ACL);
 	bprintf(acln, "%.*s", PF(an));
 
-	ExpectErr(tl, '{');
-	vcc_NextToken(tl);
+	SkipToken(tl, '{');
 
 	while (tl->t->tok != '}') {
 		vcc_acl_entry(tl);
 		ERRCHK(tl);
-		ExpectErr(tl, ';');
-		vcc_NextToken(tl);
+		SkipToken(tl, ';');
 	}
-	ExpectErr(tl, '}');
-	vcc_NextToken(tl);
+	SkipToken(tl, '}');
 
 	vcc_acl_emit(tl, acln, 0);
 }

Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_action.c
===================================================================
--- branches/2.1/varnish-cache/lib/libvcl/vcc_action.c	2010-04-19 11:04:19 UTC (rev 4676)
+++ branches/2.1/varnish-cache/lib/libvcl/vcc_action.c	2010-04-19 11:10:02 UTC (rev 4677)
@@ -232,8 +232,7 @@
 		Fb(tl, 0, ");\n");
 		break;
 	case HASH:
-		ExpectErr(tl, T_INCR);
-		vcc_NextToken(tl);
+		SkipToken(tl, T_INCR);
 		if (!vcc_StringVal(tl)) {
 			ERRCHK(tl);
 			vcc_ExpectedStringval(tl);

Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_backend.c
===================================================================
--- branches/2.1/varnish-cache/lib/libvcl/vcc_backend.c	2010-04-19 11:04:19 UTC (rev 4676)
+++ branches/2.1/varnish-cache/lib/libvcl/vcc_backend.c	2010-04-19 11:10:02 UTC (rev 4677)
@@ -259,8 +259,7 @@
 	    "?initial",
 	    NULL);
 
-	ExpectErr(tl, '{');
-	vcc_NextToken(tl);
+	SkipToken(tl, '{');
 
 	window = 0;
 	threshold = 0;
@@ -334,8 +333,7 @@
 			return;
 		}
 
-		ExpectErr(tl, ';');
-		vcc_NextToken(tl);
+		SkipToken(tl, ';');
 	}
 
 	if (t_threshold != NULL || t_window != NULL) {
@@ -376,8 +374,7 @@
 	if (status > 0)
 		Fb(tl, 0, "\t\t.exp_status = %u,\n", status);
 	Fb(tl, 0, "\t},\n");
-	ExpectErr(tl, '}');
-	vcc_NextToken(tl);
+	SkipToken(tl, '}');
 }
 
 /*--------------------------------------------------------------------
@@ -415,8 +412,7 @@
 	    NULL);
 	t_first = tl->t;
 
-	ExpectErr(tl, '{');
-	vcc_NextToken(tl);
+	SkipToken(tl, '{');
 
 	vsb = vsb_newauto();
 	AN(vsb);
@@ -451,49 +447,42 @@
 			assert(tl->t->dec != NULL);
 			t_host = tl->t;
 			vcc_NextToken(tl);
-			ExpectErr(tl, ';');
-			vcc_NextToken(tl);
+			SkipToken(tl, ';');
 		} else if (vcc_IdIs(t_field, "port")) {
 			ExpectErr(tl, CSTR);
 			assert(tl->t->dec != NULL);
 			t_port = tl->t;
 			vcc_NextToken(tl);
-			ExpectErr(tl, ';');
-			vcc_NextToken(tl);
+			SkipToken(tl, ';');
 		} else if (vcc_IdIs(t_field, "host_header")) {
 			ExpectErr(tl, CSTR);
 			assert(tl->t->dec != NULL);
 			t_hosthdr = tl->t;
 			vcc_NextToken(tl);
-			ExpectErr(tl, ';');
-			vcc_NextToken(tl);
+			SkipToken(tl, ';');
 		} else if (vcc_IdIs(t_field, "connect_timeout")) {
 			Fb(tl, 0, "\t.connect_timeout = ");
 			vcc_TimeVal(tl);
 			ERRCHK(tl);
 			Fb(tl, 0, ",\n");
-			ExpectErr(tl, ';');
-			vcc_NextToken(tl);
+			SkipToken(tl, ';');
 		} else if (vcc_IdIs(t_field, "first_byte_timeout")) {
 			Fb(tl, 0, "\t.first_byte_timeout = ");
 			vcc_TimeVal(tl);
 			ERRCHK(tl);
 			Fb(tl, 0, ",\n");
-			ExpectErr(tl, ';');
-			vcc_NextToken(tl);
+			SkipToken(tl, ';');
 		} else if (vcc_IdIs(t_field, "between_bytes_timeout")) {
 			Fb(tl, 0, "\t.between_bytes_timeout = ");
 			vcc_TimeVal(tl);
 			ERRCHK(tl);
 			Fb(tl, 0, ",\n");
-			ExpectErr(tl, ';');
-			vcc_NextToken(tl);
+			SkipToken(tl, ';');
 		} else if (vcc_IdIs(t_field, "max_connections")) {
 			u = vcc_UintVal(tl);
 			vcc_NextToken(tl);
 			ERRCHK(tl);
-			ExpectErr(tl, ';');
-			vcc_NextToken(tl);
+			SkipToken(tl, ';');
 			Fb(tl, 0, "\t.max_connections = %u,\n", u);
 		} else if (vcc_IdIs(t_field, "saintmode_threshold")) {
 			u = vcc_UintVal(tl);
@@ -510,8 +499,7 @@
 			vcc_NextToken(tl);
 			ERRCHK(tl);
 			saint = u;
-			ExpectErr(tl, ';');
-			vcc_NextToken(tl);
+			SkipToken(tl, ';');
 		} else if (vcc_IdIs(t_field, "probe")) {
 			vcc_ParseProbe(tl);
 			ERRCHK(tl);
@@ -616,8 +604,7 @@
 		}
 		vcc_AddRef(tl, h->name, R_BACKEND);
 		vcc_NextToken(tl);
-		ExpectErr(tl, ';');
-		vcc_NextToken(tl);
+		SkipToken(tl, ';');
 		*nm = h->vgcname;
 	} else if (tl->t->tok == '{') {
 		t = tl->t;
@@ -721,13 +708,10 @@
 			vcc_ErrWhere(tl, tl->t_policy);
 			return;
 		}
-		ExpectErr(tl, '{');
-		vcc_NextToken(tl);
+		SkipToken(tl, '{');
 		dl->func(tl);
-		if (!tl->err) {
-			ExpectErr(tl, '}');
-			vcc_NextToken(tl);
-		}
+		if (!tl->err)
+			SkipToken(tl, '}');
 		Fi(tl, 0,
 		    "\tVRT_init_dir(cli, VCL_conf.director, \"%.*s\",\n",
 		    PF(tl->t_policy));

Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_backend_util.c
===================================================================
--- branches/2.1/varnish-cache/lib/libvcl/vcc_backend_util.c	2010-04-19 11:04:19 UTC (rev 4676)
+++ branches/2.1/varnish-cache/lib/libvcl/vcc_backend_util.c	2010-04-19 11:10:02 UTC (rev 4677)
@@ -98,14 +98,12 @@
 {
 	struct token *t_field;
 
-	ExpectErr(tl, '.');
-	vcc_NextToken(tl);
+	SkipToken(tl, '.');
 	ExpectErr(tl, ID);
 	t_field = tl->t;
 	*t = t_field;
 	vcc_NextToken(tl);
-	ExpectErr(tl, '=');
-	vcc_NextToken(tl);
+	SkipToken(tl, '=');
 
 	for (; fs->name != NULL; fs++) {
 		if (!vcc_IdIs(t_field, fs->name + 1))

Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_compile.h
===================================================================
--- branches/2.1/varnish-cache/lib/libvcl/vcc_compile.h	2010-04-19 11:04:19 UTC (rev 4676)
+++ branches/2.1/varnish-cache/lib/libvcl/vcc_compile.h	2010-04-19 11:10:02 UTC (rev 4677)
@@ -242,4 +242,7 @@
 #define ERRCHK(tl)      do { if ((tl)->err) return; } while (0)
 #define ErrInternal(tl) vcc__ErrInternal(tl, __func__, __LINE__)
 #define Expect(a, b) vcc__Expect(a, b, __LINE__)
-#define ExpectErr(a, b) do { vcc__Expect(a, b, __LINE__); ERRCHK(a);} while (0)
+#define ExpectErr(a, b) \
+    do { vcc__Expect(a, b, __LINE__); ERRCHK(a);} while (0)
+#define SkipToken(a, b) \
+    do { vcc__Expect(a, b, __LINE__); ERRCHK(a); vcc_NextToken(a); } while (0)

Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c
===================================================================
--- branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c	2010-04-19 11:04:19 UTC (rev 4676)
+++ branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c	2010-04-19 11:10:02 UTC (rev 4677)
@@ -70,8 +70,7 @@
 			retries = vcc_UintVal(tl);
 			ERRCHK(tl);
 			vcc_NextToken(tl);
-			ExpectErr(tl, ';');
-			vcc_NextToken(tl);
+			SkipToken(tl, ';');
 		} else {
 			ErrInternal(tl);
 		}
@@ -88,8 +87,7 @@
 		t_be = tl->t;
 		vcc_ResetFldSpec(mfs);
 
-		ExpectErr(tl, '{');
-		vcc_NextToken(tl);
+		SkipToken(tl, '{');
 		Fc(tl, 0, "\t{");
 
 		while (tl->t->tok != '}') {	/* Member fields */
@@ -116,8 +114,7 @@
 				}
 				Fc(tl, 0, "%s .weight = %u", first, u);
 				vcc_NextToken(tl);
-				ExpectErr(tl, ';');
-				vcc_NextToken(tl);
+				SkipToken(tl, ';');
 			} else {
 				ErrInternal(tl);
 			}


Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4648
   + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4649

Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_round_robin.c
===================================================================
--- branches/2.1/varnish-cache/lib/libvcl/vcc_dir_round_robin.c	2010-04-19 11:04:19 UTC (rev 4676)
+++ branches/2.1/varnish-cache/lib/libvcl/vcc_dir_round_robin.c	2010-04-19 11:10:02 UTC (rev 4677)
@@ -67,8 +67,7 @@
 		t_be = tl->t;
 		vcc_ResetFldSpec(fs);
 
-		ExpectErr(tl, '{');
-		vcc_NextToken(tl);
+		SkipToken(tl, '{');
 		Fc(tl, 0, "\t{");
 
 		while (tl->t->tok != '}') {	/* Member fields */

Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_parse.c
===================================================================
--- branches/2.1/varnish-cache/lib/libvcl/vcc_parse.c	2010-04-19 11:04:19 UTC (rev 4676)
+++ branches/2.1/varnish-cache/lib/libvcl/vcc_parse.c	2010-04-19 11:10:02 UTC (rev 4677)
@@ -344,8 +344,7 @@
 	if (tl->t->tok == '(') {
 		vcc_NextToken(tl);
 		Cond_0(tl);
-		ExpectErr(tl, ')');
-		vcc_NextToken(tl);
+		SkipToken(tl, ')');
 	} else if (tl->t->tok == VAR) {
 		vp = vcc_FindVar(tl, tl->t, vcc_vars);
 		ERRCHK(tl);
@@ -412,14 +411,12 @@
 Conditional(struct tokenlist *tl)
 {
 
-	ExpectErr(tl, '(');
-	vcc_NextToken(tl);
+	SkipToken(tl, '(');
 	Fb(tl, 1, "(\n");
 	L(tl, Cond_0(tl));
 	ERRCHK(tl);
 	Fb(tl, 1, ")\n");
-	ExpectErr(tl, ')');
-	vcc_NextToken(tl);
+	SkipToken(tl, ')');
 }
 
 /*--------------------------------------------------------------------*/
@@ -428,9 +425,8 @@
 IfStmt(struct tokenlist *tl)
 {
 
-	ExpectErr(tl, T_IF);
+	SkipToken(tl, T_IF);
 	Fb(tl, 1, "if \n");
-	vcc_NextToken(tl);
 	L(tl, Conditional(tl));
 	ERRCHK(tl);
 	L(tl, Compound(tl));
@@ -469,11 +465,10 @@
 {
 	int i;
 
-	ExpectErr(tl, '{');
+	SkipToken(tl, '{');
 	Fb(tl, 1, "{\n");
 	tl->indent += INDENT;
 	C(tl, ";");
-	vcc_NextToken(tl);
 	while (1) {
 		ERRCHK(tl);
 		switch (tl->t->tok) {
@@ -503,8 +498,7 @@
 			i = vcc_ParseAction(tl);
 			ERRCHK(tl);
 			if (i) {
-				ExpectErr(tl, ';');
-				vcc_NextToken(tl);
+				SkipToken(tl, ';');
 				break;
 			}
 			/* FALLTHROUGH */




More information about the varnish-commit mailing list