[master] 2cbaf86 Allow for functions which takes no arguments.

Poul-Henning Kamp phk at varnish-cache.org
Mon May 16 09:42:47 CEST 2011


commit 2cbaf866ed92846309742c7e4ef8878aef035212
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon May 16 07:42:27 2011 +0000

    Allow for functions which takes no arguments.
    
    Spotted by: Martin

diff --git a/lib/libvcl/vcc_expr.c b/lib/libvcl/vcc_expr.c
index 14ddf0b..0839e8b 100644
--- a/lib/libvcl/vcc_expr.c
+++ b/lib/libvcl/vcc_expr.c
@@ -518,7 +518,7 @@ vcc_Eval_Var(struct vcc *tl, struct expr **e, const struct symbol *sym)
 void
 vcc_Eval_Func(struct vcc *tl, struct expr **e, const struct symbol *sym)
 {
-	const char *p, *q, *r;
+	const char *p, *r;
 	struct expr *e1, *e2;
 	enum var_type fmt;
 	char buf[32];
@@ -529,8 +529,7 @@ vcc_Eval_Func(struct vcc *tl, struct expr **e, const struct symbol *sym)
 	SkipToken(tl, ID);
 	SkipToken(tl, '(');
 	p = sym->args;
-	e2 = vcc_mk_expr(vcc_arg_type(&p), "%s(sp, \v+", sym->cfunc);
-	q = "\v1\n\v2";
+	e2 = vcc_mk_expr(vcc_arg_type(&p), "%s(sp\v+", sym->cfunc);
 	while (*p != '\0') {
 		e1 = NULL;
 		fmt = vcc_arg_type(&p);
@@ -619,8 +618,7 @@ vcc_Eval_Func(struct vcc *tl, struct expr **e, const struct symbol *sym)
 			if (*p != '\0')
 				SkipToken(tl, ',');
 		}
-		e2 = vcc_expr_edit(e2->fmt, q, e2, e1);
-		q = "\v1,\n\v2";
+		e2 = vcc_expr_edit(e2->fmt, "\v1,\n\v2", e2, e1);
 	}
 	SkipToken(tl, ')');
 	e2 = vcc_expr_edit(e2->fmt, "\v1\n)\v-", e2, NULL);



More information about the varnish-commit mailing list