Commit 8bd29a1e authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Get don't subtract when addition is required.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@5132 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 9cc56b49
......@@ -65,37 +65,25 @@ parse_call(struct vcc *tl)
static void
parse_error(struct vcc *tl)
{
const struct var *vp;
int paran = 0;
vcc_NextToken(tl);
if (tl->t->tok == ID) {
vp = vcc_FindVar(tl, tl->t, 0, "cannot be read");
ERRCHK(tl);
assert(vp != NULL);
if (vp->fmt == INT) {
Fb(tl, 1, "VRT_error(sp, %s", vp->rname);
vcc_NextToken(tl);
} else {
Fb(tl, 1, "VRT_error(sp, 0");
}
} else if (tl->t->tok == CNUM) {
Fb(tl, 1, "VRT_error(sp, %u", vcc_UintVal(tl));
} else
Fb(tl, 1, "VRT_error(sp, 0");
if (tl->t->tok == CSTR) {
Fb(tl, 0, ", %.*s", PF(tl->t));
if (tl->t->tok == '(') {
paran = 1;
vcc_NextToken(tl);
} else if (tl->t->tok == ID) {
Fb(tl, 0, ", ");
if (!vcc_StringVal(tl)) {
ERRCHK(tl);
vcc_ExpectedStringval(tl);
return;
}
}
Fb(tl, 1, "VRT_error(sp,\n");
vcc_Expr(tl, INT);
if (tl->t->tok == ',') {
Fb(tl, 1, ",\n");
vcc_NextToken(tl);
vcc_Expr(tl, STRING);
} else {
Fb(tl, 0, ", (const char *)0");
Fb(tl, 1, ", 0\n");
}
Fb(tl, 0, ");\n");
if (paran)
SkipToken(tl, ')');
Fb(tl, 1, ");\n");
Fb(tl, 1, "VRT_done(sp, VCL_RET_ERROR);\n");
}
......
......@@ -480,6 +480,7 @@ vcc_expr_mul(struct vcc *tl, struct expr **e, enum var_type fmt)
{
struct expr *e2;
enum var_type f2, f3;
struct token *tk;
*e = NULL;
vcc_expr4(tl, e, fmt);
......@@ -493,10 +494,11 @@ vcc_expr_mul(struct vcc *tl, struct expr **e, enum var_type fmt)
return;
}
while (tl->t->tok == '+' || tl->t->tok == '-') {
tk = tl->t;
vcc_NextToken(tl);
vcc_expr4(tl, &e2, f2);
ERRCHK(tl);
if (tl->t->tok == '+')
if (tk->tok == '+')
*e = vcc_expr_edit(f3, "(\v1+\v2)", *e, e2);
else
*e = vcc_expr_edit(f3, "(\v1-\v2)", *e, e2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment