Hi,

Someone on #varnish mentioned the need for this.

Personally I can't think of any reason for not allowing it.

Comments? OK?
From be543b8ca38120bc84d25aa6fea21e56f4c06443 Mon Sep 17 00:00:00 2001
From: "Federico G. Schwindt" <[email protected]>
Date: Thu, 28 Jan 2016 18:07:56 +0000
Subject: [PATCH] Add support for REAL [+-] REAL operations

---
 bin/varnishtest/tests/v00020.vtc | 3 +++
 lib/libvcc/vcc_expr.c            | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/bin/varnishtest/tests/v00020.vtc b/bin/varnishtest/tests/v00020.vtc
index a9e9d3b..6c87086 100644
--- a/bin/varnishtest/tests/v00020.vtc
+++ b/bin/varnishtest/tests/v00020.vtc
@@ -107,6 +107,9 @@ varnish v1 -vcl {
 		set req.http.foo = 1 + 1;
 		set req.http.foo = 1 - 1;
 
+		set req.http.foo = 1.5 + 2.3;
+		set req.http.foo = 1.9 - 0.7;
+
 		set req.ttl = 1s;
 	}
 }
diff --git a/lib/libvcc/vcc_expr.c b/lib/libvcc/vcc_expr.c
index 5989f07..a503e96 100644
--- a/lib/libvcc/vcc_expr.c
+++ b/lib/libvcc/vcc_expr.c
@@ -1049,6 +1049,8 @@ vcc_expr_add(struct vcc *tl, struct expr **e, enum var_type fmt)
 			/* OK */
 		} else if ((*e)->fmt == INT && e2->fmt == INT) {
 			/* OK */
+		} else if ((*e)->fmt == REAL && e2->fmt == REAL) {
+			/* OK */
 		} else if ((*e)->fmt == DURATION && e2->fmt == DURATION) {
 			/* OK */
 		} else if (tk->tok == '+' &&
-- 
2.7.0.rc3

_______________________________________________
varnish-dev mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev

Reply via email to