[4.1] e3e91d0 Insert space around '+' and '-' in generated C code.
PÃ¥l Hermunn Johansen
hermunn at varnish-software.com
Wed Feb 8 10:27:05 CET 2017
commit e3e91d0e2e967dde9539b65bff45aaf8823d280a
Author: Pål Hermunn Johansen <hermunn at varnish-software.com>
Date: Tue Feb 7 14:58:53 2017 +0100
Insert space around '+' and '-' in generated C code.
This is an adaptation of 86ae6dcfa2 to the 4.1 branch. The point is to
avoid accidential ++ and -- in generated code.
diff --git a/lib/libvcc/vcc_expr.c b/lib/libvcc/vcc_expr.c
index 09d20f2..e72dcc7 100644
--- a/lib/libvcc/vcc_expr.c
+++ b/lib/libvcc/vcc_expr.c
@@ -1001,9 +1001,9 @@ vcc_expr_mul(struct vcc *tl, struct expr **e, enum var_type fmt)
ERRCHK(tl);
assert(e2->fmt == f2);
if (tk->tok == '*')
- *e = vcc_expr_edit(f3, "(\v1*\v2)", *e, e2);
+ *e = vcc_expr_edit(f3, "(\v1 * \v2)", *e, e2);
else
- *e = vcc_expr_edit(f3, "(\v1/\v2)", *e, e2);
+ *e = vcc_expr_edit(f3, "(\v1 / \v2)", *e, e2);
}
}
@@ -1113,11 +1113,11 @@ vcc_expr_add(struct vcc *tl, struct expr **e, enum var_type fmt)
return;
}
if (tk->tok == '+')
- *e = vcc_expr_edit(f2, "(\v1+\v2)", *e, e2);
+ *e = vcc_expr_edit(f2, "(\v1 + \v2)", *e, e2);
else if (f2 == TIME && e2->fmt == TIME)
- *e = vcc_expr_edit(DURATION, "(\v1-\v2)", *e, e2);
+ *e = vcc_expr_edit(DURATION, "(\v1 - \v2)", *e, e2);
else
- *e = vcc_expr_edit(f2, "(\v1-\v2)", *e, e2);
+ *e = vcc_expr_edit(f2, "(\v1 - \v2)", *e, e2);
}
}
More information about the varnish-commit
mailing list