r210 - in trunk/varnish-cache: bin/varnishd include lib/libvcl

phk at projects.linpro.no phk at projects.linpro.no
Tue Jun 20 11:41:43 CEST 2006


Author: phk
Date: 2006-06-20 11:41:43 +0200 (Tue, 20 Jun 2006)
New Revision: 210

Modified:
   trunk/varnish-cache/bin/varnishd/cache_vrt.c
   trunk/varnish-cache/include/vcl_lang.h
   trunk/varnish-cache/include/vrt.h
   trunk/varnish-cache/lib/libvcl/vcl_compile.c
   trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c
Log:
Work towards making struct sess opaque to the generated code.


Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt.c	2006-06-20 09:28:00 UTC (rev 209)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt.c	2006-06-20 09:41:43 UTC (rev 210)
@@ -67,3 +67,12 @@
 	assert(http_GetReq(sp->http, &p));
 	return (p);
 }
+
+/*--------------------------------------------------------------------*/
+
+void
+VRT_handling(struct sess *sp, enum handling hand)
+{
+
+	sp->handling = hand;
+}

Modified: trunk/varnish-cache/include/vcl_lang.h
===================================================================
--- trunk/varnish-cache/include/vcl_lang.h	2006-06-20 09:28:00 UTC (rev 209)
+++ trunk/varnish-cache/include/vcl_lang.h	2006-06-20 09:41:43 UTC (rev 210)
@@ -47,8 +47,6 @@
 
 	enum handling		handling;
 
-	char			done;
-
 	TAILQ_ENTRY(sess)	list;
 
 	sesscb_f		*sesscb;
@@ -82,7 +80,7 @@
 #endif
 
 typedef void vcl_init_f(void);
-typedef void vcl_func_f(struct sess *sp);
+typedef int vcl_func_f(struct sess *sp);
 
 struct VCL_conf {
 	unsigned	magic;

Modified: trunk/varnish-cache/include/vrt.h
===================================================================
--- trunk/varnish-cache/include/vrt.h	2006-06-20 09:28:00 UTC (rev 209)
+++ trunk/varnish-cache/include/vrt.h	2006-06-20 09:41:43 UTC (rev 210)
@@ -31,10 +31,10 @@
 
 char *VRT_GetHdr(struct sess *, const char *);
 char *VRT_GetReq(struct sess *);
+void VRT_handling(struct sess *sp, enum handling hand);
 
-#define VRT_done(sess, hand)			\
+#define VRT_done(sp, hand)			\
 	do {					\
-		sess->handling = hand;		\
-		sess->done = 1;			\
-		return;				\
+		VRT_handling(sp, hand);		\
+		return (1);			\
 	} while (0)

Modified: trunk/varnish-cache/lib/libvcl/vcl_compile.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcl_compile.c	2006-06-20 09:28:00 UTC (rev 209)
+++ trunk/varnish-cache/lib/libvcl/vcl_compile.c	2006-06-20 09:41:43 UTC (rev 210)
@@ -962,12 +962,11 @@
 	case T_CALL:
 		ExpectErr(tl, ID);
 		AddRef(tl, tl->t, R_FUNC);
-		I(tl);
-		sbuf_printf(tl->fc, "VGC_function_%*.*s(sp);\n",
+		I(tl); sbuf_printf(tl->fc,
+		    "if (VGC_function_%*.*s(sp))\n",
 		    tl->t->e - tl->t->b,
 		    tl->t->e - tl->t->b, tl->t->b);
-		I(tl); sbuf_printf(tl->fc, "if (sp->done)\n");
-		I(tl); sbuf_printf(tl->fc, "\treturn;\n");
+		I(tl); sbuf_printf(tl->fc, "\treturn (1);\n");
 		NextToken(tl);
 		return;
 	case T_REWRITE:
@@ -1291,13 +1290,11 @@
 	NextToken(tl);
 	ExpectErr(tl, ID);
 	AddDef(tl, tl->t, R_FUNC);
-	sbuf_printf(tl->fh, "static void VGC_function_%*.*s (struct sess *sp);\n",
+	sbuf_printf(tl->fh, "static int VGC_function_%*.*s (struct sess *sp);\n",
 	    tl->t->e - tl->t->b,
 	    tl->t->e - tl->t->b, tl->t->b);
-	I(tl);
-	sbuf_printf(tl->fc, "static void\n");
-	I(tl);
-	sbuf_printf(tl->fc, "VGC_function_%*.*s (struct sess *sp)\n",
+	I(tl); sbuf_printf(tl->fc, "static int\n");
+	I(tl); sbuf_printf(tl->fc, "VGC_function_%*.*s (struct sess *sp)\n",
 	    tl->t->e - tl->t->b,
 	    tl->t->e - tl->t->b, tl->t->b);
 	NextToken(tl);

Modified: trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c	2006-06-20 09:28:00 UTC (rev 209)
+++ trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c	2006-06-20 09:41:43 UTC (rev 210)
@@ -446,8 +446,6 @@
 	fputs("\n", f);
 	fputs("	enum handling		handling;\n", f);
 	fputs("\n", f);
-	fputs("	char			done;\n", f);
-	fputs("\n", f);
 	fputs("	TAILQ_ENTRY(sess)	list;\n", f);
 	fputs("\n", f);
 	fputs("	sesscb_f		*sesscb;\n", f);
@@ -481,7 +479,7 @@
 	fputs("#endif\n", f);
 	fputs("\n", f);
 	fputs("typedef void vcl_init_f(void);\n", f);
-	fputs("typedef void vcl_func_f(struct sess *sp);\n", f);
+	fputs("typedef int vcl_func_f(struct sess *sp);\n", f);
 	fputs("\n", f);
 	fputs("struct VCL_conf {\n", f);
 	fputs("	unsigned	magic;\n", f);
@@ -529,11 +527,11 @@
 	fputs("\n", f);
 	fputs("char *VRT_GetHdr(struct sess *, const char *);\n", f);
 	fputs("char *VRT_GetReq(struct sess *);\n", f);
+	fputs("void VRT_handling(struct sess *sp, enum handling hand);\n", f);
 	fputs("\n", f);
-	fputs("#define VRT_done(sess, hand)			\\\n", f);
+	fputs("#define VRT_done(sp, hand)			\\\n", f);
 	fputs("	do {					\\\n", f);
-	fputs("		sess->handling = hand;		\\\n", f);
-	fputs("		sess->done = 1;			\\\n", f);
-	fputs("		return;				\\\n", f);
+	fputs("		VRT_handling(sp, hand);		\\\n", f);
+	fputs("		return (1);			\\\n", f);
 	fputs("	} while (0)\n", f);
 }




More information about the varnish-commit mailing list