Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
1f1d4872
Commit
1f1d4872
authored
Feb 02, 2016
by
Federico G. Schwindt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add REAL add/sub/mul/div REAL support
Prompted by someone on #varnish. OK'd by phk.
parent
bbf5a340
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
v00020.vtc
bin/varnishtest/tests/v00020.vtc
+8
-0
vcc_expr.c
lib/libvcc/vcc_expr.c
+3
-0
No files found.
bin/varnishtest/tests/v00020.vtc
View file @
1f1d4872
...
@@ -102,10 +102,18 @@ varnish v1 -vcl {
...
@@ -102,10 +102,18 @@ varnish v1 -vcl {
set req.http.foo = now + 1s;
set req.http.foo = now + 1s;
set req.http.foo = now - 1s;
set req.http.foo = now - 1s;
set req.http.foo = now - now;
set req.http.foo = now - now;
set req.http.foo = 1 + 1;
set req.http.foo = 1 + 1;
set req.http.foo = 1 - 1;
set req.http.foo = 1 - 1;
set req.http.foo = 3 * 2;
set req.http.foo = 3 / 2;
set req.http.foo = 3.6 + 1.4;
set req.http.foo = 3.6 - 1.4;
set req.http.foo = 3.6 * 1.4;
set req.http.foo = 3.6 / 1.4;
set req.ttl = 1s;
set req.ttl = 1s;
}
}
...
...
lib/libvcc/vcc_expr.c
View file @
1f1d4872
...
@@ -942,6 +942,7 @@ vcc_expr_mul(struct vcc *tl, struct expr **e, enum var_type fmt)
...
@@ -942,6 +942,7 @@ vcc_expr_mul(struct vcc *tl, struct expr **e, enum var_type fmt)
case
INT
:
f2
=
INT
;
break
;
case
INT
:
f2
=
INT
;
break
;
case
DURATION
:
f2
=
REAL
;
break
;
case
DURATION
:
f2
=
REAL
;
break
;
case
BYTES
:
f2
=
REAL
;
break
;
case
BYTES
:
f2
=
REAL
;
break
;
case
REAL
:
f2
=
REAL
;
break
;
default:
default:
if
(
tl
->
t
->
tok
!=
'*'
&&
tl
->
t
->
tok
!=
'/'
)
if
(
tl
->
t
->
tok
!=
'*'
&&
tl
->
t
->
tok
!=
'/'
)
return
;
return
;
...
@@ -1049,6 +1050,8 @@ vcc_expr_add(struct vcc *tl, struct expr **e, enum var_type fmt)
...
@@ -1049,6 +1050,8 @@ vcc_expr_add(struct vcc *tl, struct expr **e, enum var_type fmt)
/* OK */
/* OK */
}
else
if
((
*
e
)
->
fmt
==
INT
&&
e2
->
fmt
==
INT
)
{
}
else
if
((
*
e
)
->
fmt
==
INT
&&
e2
->
fmt
==
INT
)
{
/* OK */
/* OK */
}
else
if
((
*
e
)
->
fmt
==
REAL
&&
e2
->
fmt
==
REAL
)
{
/* OK */
}
else
if
((
*
e
)
->
fmt
==
DURATION
&&
e2
->
fmt
==
DURATION
)
{
}
else
if
((
*
e
)
->
fmt
==
DURATION
&&
e2
->
fmt
==
DURATION
)
{
/* OK */
/* OK */
}
else
if
(
tk
->
tok
==
'+'
&&
}
else
if
(
tk
->
tok
==
'+'
&&
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment