r5204 - trunk/varnish-cache/lib/libvcl
phk at varnish-cache.org
phk at varnish-cache.org
Tue Sep 14 10:37:50 CEST 2010
Author: phk
Date: 2010-09-14 10:37:50 +0200 (Tue, 14 Sep 2010)
New Revision: 5204
Modified:
trunk/varnish-cache/lib/libvcl/vcc_expr.c
trunk/varnish-cache/lib/libvcl/vcc_vmod.c
Log:
VMOD functions which return VOID are really procedures and cannot be used
in expressoins.
Modified: trunk/varnish-cache/lib/libvcl/vcc_expr.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_expr.c 2010-09-14 07:50:29 UTC (rev 5203)
+++ trunk/varnish-cache/lib/libvcl/vcc_expr.c 2010-09-14 08:37:50 UTC (rev 5204)
@@ -538,7 +538,8 @@
}
AN(sym);
- if (sym->kind == SYM_VAR) {
+ switch(sym->kind) {
+ case SYM_VAR:
vcc_AddUses(tl, tl->t, sym->r_methods, "Not available");
vp = vcc_FindVar(tl, tl->t, 0, "cannot be read");
ERRCHK(tl);
@@ -546,12 +547,19 @@
vsb_printf(e1->vsb, "%s", vp->rname);
e1->fmt = vp->fmt;
vcc_NextToken(tl);
- } else if (sym->kind == SYM_FUNC) {
+ break;
+ case SYM_FUNC:
vcc_expr_call(tl, &e1, sym);
ERRCHK(tl);
*e = e1;
return;
- } else {
+ case SYM_PROC:
+ vsb_printf(tl->sb,
+ "%.*s() is a procedure, it returns no data.\n",
+ PF(tl->t));
+ vcc_ErrWhere(tl, tl->t);
+ return;
+ default:
vsb_printf(tl->sb, "Wrong kind of symbol.\n");
vcc_ErrWhere(tl, tl->t);
return;
@@ -908,7 +916,8 @@
vcc_expr_fmt(tl->fb, tl->indent, e);
vsb_putc(tl->fb, '\n');
} else {
- vcc_ErrWhere2(tl, t1, tl->t);
+ if (t1 != tl->t)
+ vcc_ErrWhere2(tl, t1, tl->t);
}
vcc_delete_expr(e);
}
Modified: trunk/varnish-cache/lib/libvcl/vcc_vmod.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_vmod.c 2010-09-14 07:50:29 UTC (rev 5203)
+++ trunk/varnish-cache/lib/libvcl/vcc_vmod.c 2010-09-14 08:37:50 UTC (rev 5204)
@@ -156,6 +156,10 @@
sym->cfunc = p;
p += strlen(p) + 1;
sym->args = p;
+
+ /* Functions which return VOID are procedures */
+ if (!memcmp(p, "VOID\0", 5))
+ sym->kind = SYM_PROC;
}
}
Fh(tl, 0, "\n%s\n", proto);
More information about the varnish-commit
mailing list