r4393 - trunk/varnish-cache/lib/libvcl

phk at projects.linpro.no phk at projects.linpro.no
Tue Dec 15 11:32:21 CET 2009


Author: phk
Date: 2009-12-15 11:32:21 +0100 (Tue, 15 Dec 2009)
New Revision: 4393

Modified:
   trunk/varnish-cache/lib/libvcl/vcc_action.c
   trunk/varnish-cache/lib/libvcl/vcc_backend.c
   trunk/varnish-cache/lib/libvcl/vcc_dir_random.c
   trunk/varnish-cache/lib/libvcl/vcc_dir_round_robin.c
   trunk/varnish-cache/lib/libvcl/vcc_parse.c
Log:
Change the way we identify backends internally in the compiled VCL code.



Modified: trunk/varnish-cache/lib/libvcl/vcc_action.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_action.c	2009-12-14 13:03:08 UTC (rev 4392)
+++ trunk/varnish-cache/lib/libvcl/vcc_action.c	2009-12-15 10:32:21 UTC (rev 4393)
@@ -251,7 +251,7 @@
 		vcc_ExpectCid(tl);
 		ERRCHK(tl);
 		vcc_AddRef(tl, tl->t, R_BACKEND);
-		Fb(tl, 0, "VGC_backend_%.*s", PF(tl->t));
+		Fb(tl, 0, "VGC_backend__%.*s", PF(tl->t));
 		vcc_NextToken(tl);
 		Fb(tl, 0, ");\n");
 		break;

Modified: trunk/varnish-cache/lib/libvcl/vcc_backend.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_backend.c	2009-12-14 13:03:08 UTC (rev 4392)
+++ trunk/varnish-cache/lib/libvcl/vcc_backend.c	2009-12-15 10:32:21 UTC (rev 4393)
@@ -199,8 +199,13 @@
 	AN(qual);
 	assert(first != last);
 	vsb_printf(v, "\t.ident =");
-	vsb_printf(v, "\n\t    \"%.*s %.*s [%d] \"",
-	    PF(qual), PF(name), serial);
+	if (serial >= 0) {
+		vsb_printf(v, "\n\t    \"%.*s %.*s [%d] \"",
+		    PF(qual), PF(name), serial);
+	} else {
+		vsb_printf(v, "\n\t    \"%.*s %.*s \"",
+		    PF(qual), PF(name));
+	}
 	while (1) {
 		if (first->dec != NULL)
 			vsb_printf(v, "\n\t    \"\\\"\" %.*s \"\\\" \"",
@@ -522,7 +527,7 @@
 	Fb(tl, 0, "\nstatic const struct vrt_backend bh_%d = {\n", *nbh);
 
 	Fb(tl, 0, "\t.vcl_name = \"%.*s", PF(name));
-	if (serial)
+	if (serial >= 0)
 		Fb(tl, 0, "[%d]", serial);
 	Fb(tl, 0, "\",\n");
 
@@ -741,15 +746,15 @@
 	h = TlAlloc(tl, sizeof *h);
 	h->name = t_dir;
 
-	vcc_ParseHostDef(tl, &h->hnum, h->name, t_first, 0);
+	vcc_ParseHostDef(tl, &h->hnum, h->name, t_first, -1);
 	ERRCHK(tl);
 
 	VTAILQ_INSERT_TAIL(&tl->hosts, h, list);
 
 	Fi(tl, 0,
-	    "\tVRT_init_dir_simple(cli, &VGC_backend_%.*s , &bh_%d);\n",
+	    "\tVRT_init_dir_simple(cli, &VGC_backend__%.*s , &bh_%d);\n",
 	    PF(h->name), h->hnum);
-	Ff(tl, 0, "\tVRT_fini_dir(cli, VGC_backend_%.*s);\n", PF(h->name));
+	Ff(tl, 0, "\tVRT_fini_dir(cli, VGC_backend__%.*s);\n", PF(h->name));
 
 }
 
@@ -780,7 +785,7 @@
 	t_dir = tl->t;
 	vcc_NextToken(tl);
 
-	Fh(tl, 1, "\n#define VGC_backend_%.*s (VCL_conf.director[%d])\n",
+	Fh(tl, 1, "\n#define VGC_backend__%.*s (VCL_conf.director[%d])\n",
 	    PF(t_dir), tl->ndirector);
 	vcc_AddDef(tl, t_dir, R_BACKEND);
 	tl->ndirector++;

Modified: trunk/varnish-cache/lib/libvcl/vcc_dir_random.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_dir_random.c	2009-12-14 13:03:08 UTC (rev 4392)
+++ trunk/varnish-cache/lib/libvcl/vcc_dir_random.c	2009-12-15 10:32:21 UTC (rev 4393)
@@ -143,7 +143,7 @@
 	Fc(tl, 0, "\t.members = vdre_%.*s,\n", PF(t_dir));
 	Fc(tl, 0, "};\n");
 	Fi(tl, 0,
-	    "\tVRT_init_dir_random(cli, &VGC_backend_%.*s , &vdr_%.*s);\n",
+	    "\tVRT_init_dir_random(cli, &VGC_backend__%.*s , &vdr_%.*s);\n",
 	    PF(t_dir), PF(t_dir));
-	Ff(tl, 0, "\tVRT_fini_dir(cli, VGC_backend_%.*s);\n", PF(t_dir));
+	Ff(tl, 0, "\tVRT_fini_dir(cli, VGC_backend__%.*s);\n", PF(t_dir));
 }

Modified: trunk/varnish-cache/lib/libvcl/vcc_dir_round_robin.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_dir_round_robin.c	2009-12-14 13:03:08 UTC (rev 4392)
+++ trunk/varnish-cache/lib/libvcl/vcc_dir_round_robin.c	2009-12-15 10:32:21 UTC (rev 4393)
@@ -104,6 +104,6 @@
 	Fc(tl, 0, "\t.members = vdrre_%.*s,\n", PF(t_dir));
 	Fc(tl, 0, "};\n");
 	Fi(tl, 0, "\tVRT_init_dir_round_robin("
-	    "cli, &VGC_backend_%.*s , &vdrr_%.*s);\n", PF(t_dir), PF(t_dir));
-	Ff(tl, 0, "\tVRT_fini_dir(cli, VGC_backend_%.*s);\n", PF(t_dir));
+	    "cli, &VGC_backend__%.*s , &vdrr_%.*s);\n", PF(t_dir), PF(t_dir));
+	Ff(tl, 0, "\tVRT_fini_dir(cli, VGC_backend__%.*s);\n", PF(t_dir));
 }

Modified: trunk/varnish-cache/lib/libvcl/vcc_parse.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_parse.c	2009-12-14 13:03:08 UTC (rev 4392)
+++ trunk/varnish-cache/lib/libvcl/vcc_parse.c	2009-12-15 10:32:21 UTC (rev 4393)
@@ -322,7 +322,7 @@
 	vcc_ExpectCid(tl);
 	ERRCHK(tl);
 	vcc_AddRef(tl, tl->t, R_BACKEND);
-	Fb(tl, 1, "VGC_backend_%.*s\n", PF(tl->t));
+	Fb(tl, 1, "VGC_backend__%.*s\n", PF(tl->t));
 	vcc_NextToken(tl);
 }
 



More information about the varnish-commit mailing list