]> err.no Git - varnish/commitdiff
Work towards making struct sess opaque to the generated code.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 20 Jun 2006 09:41:43 +0000 (09:41 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 20 Jun 2006 09:41:43 +0000 (09:41 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@210 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_vrt.c
varnish-cache/include/vcl_lang.h
varnish-cache/include/vrt.h
varnish-cache/lib/libvcl/vcl_compile.c
varnish-cache/lib/libvcl/vcl_fixed_token.c

index ef68cdae456d9b1db1d544dab2593e65466f50dc..33c6c78b8d4e999802d8ec75217f933f047cd852 100644 (file)
@@ -67,3 +67,12 @@ VRT_GetReq(struct sess *sp)
        assert(http_GetReq(sp->http, &p));
        return (p);
 }
+
+/*--------------------------------------------------------------------*/
+
+void
+VRT_handling(struct sess *sp, enum handling hand)
+{
+
+       sp->handling = hand;
+}
index 20fc6a726a681e1d6ee6ce2be7d250ceb08f9e0e..fed7dd7adfe5fe58aa1df6865a04dd18b6a4b1cb 100644 (file)
@@ -47,8 +47,6 @@ struct sess {
 
        enum handling           handling;
 
-       char                    done;
-
        TAILQ_ENTRY(sess)       list;
 
        sesscb_f                *sesscb;
@@ -82,7 +80,7 @@ int string_match(const char *, const char *);
 #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;
index 936f46beb8fca996dd8d335ffa01b752f78954e7..a3a24b66489f14cdc1a9bcd605525483124bb462 100644 (file)
@@ -31,10 +31,10 @@ int VRT_switch_config(const char *);
 
 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)
index f3b63d245d4d15ab51242dd7e3b58aeed0c80be9..ae7f3b97d30d657b562049b630123aa07dbe9c6a 100644 (file)
@@ -962,12 +962,11 @@ Action(struct tokenlist *tl)
        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 @@ Function(struct tokenlist *tl)
        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);
index 013d3800a479a6a03330ac9ec8d06e2c04891d57..14688b56ab881ecc33a1670d122c97ebc589659a 100644 (file)
@@ -446,8 +446,6 @@ vcl_output_lang_h(FILE *f)
        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 @@ vcl_output_lang_h(FILE *f)
        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 @@ vcl_output_lang_h(FILE *f)
        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);
 }