Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
unique-xids
Commits
c6b8697b
Commit
c6b8697b
authored
Oct 24, 2012
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Eliminate vcc_RTimeVal(), rename vcc_TimeVal() to Vcc_Duration().
Clean up some asserts.
parent
f0530c9e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
41 deletions
+17
-41
vcc_backend.c
lib/libvcl/vcc_backend.c
+5
-5
vcc_compile.h
lib/libvcl/vcc_compile.h
+1
-2
vcc_dir_dns.c
lib/libvcl/vcc_dir_dns.c
+4
-4
vcc_expr.c
lib/libvcl/vcc_expr.c
+7
-30
No files found.
lib/libvcl/vcc_backend.c
View file @
c6b8697b
...
...
@@ -278,12 +278,12 @@ vcc_ParseProbeSpec(struct vcc *tl)
Fh
(
tl
,
0
,
"
\t\t\"\\
r
\\
n
\"
,
\n
"
);
}
else
if
(
vcc_IdIs
(
t_field
,
"timeout"
))
{
Fh
(
tl
,
0
,
"
\t
.timeout = "
);
vcc_
TimeVal
(
tl
,
&
t
);
vcc_
Duration
(
tl
,
&
t
);
ERRCHK
(
tl
);
Fh
(
tl
,
0
,
"%g,
\n
"
,
t
);
}
else
if
(
vcc_IdIs
(
t_field
,
"interval"
))
{
Fh
(
tl
,
0
,
"
\t
.interval = "
);
vcc_
TimeVal
(
tl
,
&
t
);
vcc_
Duration
(
tl
,
&
t
);
ERRCHK
(
tl
);
Fh
(
tl
,
0
,
"%g,
\n
"
,
t
);
}
else
if
(
vcc_IdIs
(
t_field
,
"window"
))
{
...
...
@@ -470,19 +470,19 @@ vcc_ParseHostDef(struct vcc *tl, int serial, const char *vgcname)
SkipToken
(
tl
,
';'
);
}
else
if
(
vcc_IdIs
(
t_field
,
"connect_timeout"
))
{
Fb
(
tl
,
0
,
"
\t
.connect_timeout = "
);
vcc_
TimeVal
(
tl
,
&
t
);
vcc_
Duration
(
tl
,
&
t
);
ERRCHK
(
tl
);
Fb
(
tl
,
0
,
"%g,
\n
"
,
t
);
SkipToken
(
tl
,
';'
);
}
else
if
(
vcc_IdIs
(
t_field
,
"first_byte_timeout"
))
{
Fb
(
tl
,
0
,
"
\t
.first_byte_timeout = "
);
vcc_
TimeVal
(
tl
,
&
t
);
vcc_
Duration
(
tl
,
&
t
);
ERRCHK
(
tl
);
Fb
(
tl
,
0
,
"%g,
\n
"
,
t
);
SkipToken
(
tl
,
';'
);
}
else
if
(
vcc_IdIs
(
t_field
,
"between_bytes_timeout"
))
{
Fb
(
tl
,
0
,
"
\t
.between_bytes_timeout = "
);
vcc_
TimeVal
(
tl
,
&
t
);
vcc_
Duration
(
tl
,
&
t
);
ERRCHK
(
tl
);
Fb
(
tl
,
0
,
"%g,
\n
"
,
t
);
SkipToken
(
tl
,
';'
);
...
...
lib/libvcl/vcc_compile.h
View file @
c6b8697b
...
...
@@ -272,8 +272,7 @@ parsedirector_f vcc_ParseRandomDirector;
parsedirector_f
vcc_ParseRoundRobinDirector
;
/* vcc_expr.c */
void
vcc_RTimeVal
(
struct
vcc
*
tl
,
double
*
);
void
vcc_TimeVal
(
struct
vcc
*
tl
,
double
*
);
void
vcc_Duration
(
struct
vcc
*
tl
,
double
*
);
unsigned
vcc_UintVal
(
struct
vcc
*
tl
);
void
vcc_Expr
(
struct
vcc
*
tl
,
enum
var_type
typ
);
void
vcc_Expr_Call
(
struct
vcc
*
tl
,
const
struct
symbol
*
sym
);
...
...
lib/libvcl/vcc_dir_dns.c
View file @
c6b8697b
...
...
@@ -194,17 +194,17 @@ vcc_dir_dns_parse_backend_options(struct vcc *tl)
vcc_NextToken
(
tl
);
SkipToken
(
tl
,
';'
);
}
else
if
(
vcc_IdIs
(
t_field
,
"connect_timeout"
))
{
vcc_
TimeVal
(
tl
,
&
t
);
vcc_
Duration
(
tl
,
&
t
);
ERRCHK
(
tl
);
b_defaults
.
connect_timeout
=
t
;
SkipToken
(
tl
,
';'
);
}
else
if
(
vcc_IdIs
(
t_field
,
"first_byte_timeout"
))
{
vcc_
TimeVal
(
tl
,
&
t
);
vcc_
Duration
(
tl
,
&
t
);
ERRCHK
(
tl
);
b_defaults
.
first_byte_timeout
=
t
;
SkipToken
(
tl
,
';'
);
}
else
if
(
vcc_IdIs
(
t_field
,
"between_bytes_timeout"
))
{
vcc_
TimeVal
(
tl
,
&
t
);
vcc_
Duration
(
tl
,
&
t
);
ERRCHK
(
tl
);
b_defaults
.
between_bytes_timeout
=
t
;
SkipToken
(
tl
,
';'
);
...
...
@@ -333,7 +333,7 @@ vcc_ParseDnsDirector(struct vcc *tl)
vcc_NextToken
(
tl
);
ExpectErr
(
tl
,
';'
);
}
else
if
(
vcc_IdIs
(
t_field
,
"ttl"
))
{
vcc_
RTimeVal
(
tl
,
&
ttl
);
vcc_
Duration
(
tl
,
&
ttl
);
ExpectErr
(
tl
,
';'
);
}
else
if
(
vcc_IdIs
(
t_field
,
"list"
))
{
vcc_dir_dns_parse_list
(
tl
,
&
nelem
);
...
...
lib/libvcl/vcc_expr.c
View file @
c6b8697b
...
...
@@ -154,26 +154,7 @@ vcc_DoubleVal(struct vcc *tl)
/*--------------------------------------------------------------------*/
void
vcc_RTimeVal
(
struct
vcc
*
tl
,
double
*
d
)
{
double
v
,
sc
;
int
sign
=
1
;
if
(
tl
->
t
->
tok
==
'-'
)
{
sign
*=
-
1
;
vcc_NextToken
(
tl
);
}
v
=
vcc_DoubleVal
(
tl
);
ERRCHK
(
tl
);
ExpectErr
(
tl
,
ID
);
sc
=
vcc_TimeUnit
(
tl
);
*
d
=
sign
*
v
*
sc
;
}
/*--------------------------------------------------------------------*/
void
vcc_TimeVal
(
struct
vcc
*
tl
,
double
*
d
)
vcc_Duration
(
struct
vcc
*
tl
,
double
*
d
)
{
double
v
,
sc
;
...
...
@@ -318,6 +299,7 @@ vcc_expr_edit(enum var_type fmt, const char *p, struct expr *e1,
struct
expr
*
e
;
int
nl
=
1
;
AN
(
e1
);
e
=
vcc_new_expr
();
while
(
*
p
!=
'\0'
)
{
if
(
*
p
!=
'\v'
)
{
...
...
@@ -332,7 +314,6 @@ vcc_expr_edit(enum var_type fmt, const char *p, struct expr *e1,
case
'+'
:
VSB_cat
(
e
->
vsb
,
"
\v
+"
);
break
;
case
'-'
:
VSB_cat
(
e
->
vsb
,
"
\v
-"
);
break
;
case
'1'
:
AN
(
e1
);
VSB_cat
(
e
->
vsb
,
VSB_data
(
e1
->
vsb
));
break
;
case
'2'
:
...
...
@@ -345,14 +326,10 @@ vcc_expr_edit(enum var_type fmt, const char *p, struct expr *e1,
p
++
;
}
AZ
(
VSB_finish
(
e
->
vsb
));
if
(
e1
!=
NULL
)
e
->
t1
=
e1
->
t1
;
else
if
(
e2
!=
NULL
)
e
->
t1
=
e2
->
t1
;
e
->
t1
=
e1
->
t1
;
e
->
t2
=
e1
->
t2
;
if
(
e2
!=
NULL
)
e
->
t2
=
e2
->
t2
;
else
if
(
e1
!=
NULL
)
e
->
t2
=
e1
->
t2
;
vcc_delete_expr
(
e1
);
vcc_delete_expr
(
e2
);
e
->
fmt
=
fmt
;
...
...
@@ -392,7 +369,7 @@ vcc_expr_fmt(struct vsb *d, int ind, const struct expr *e1)
case
'+'
:
ind
+=
2
;
break
;
case
'-'
:
ind
-=
2
;
break
;
default:
assert
(
__LINE__
==
0
);
WRONG
(
"Illegal format in VCC expression"
);
}
p
++
;
}
...
...
@@ -491,7 +468,7 @@ vcc_Eval_Regsub(struct vcc *tl, struct expr **e, const struct symbol *sym)
return
;
if
(
e2
->
fmt
!=
STRING
)
vcc_expr_tostring
(
&
e2
,
STRING
);
*
e
=
vcc_expr_edit
(
STRING
,
"
\v
1,
\n\v
2)
\v
-"
,
*
e
,
e2
);
*
e
=
vcc_expr_edit
(
STRING
,
"
\v
1,
\n\v
2)
\v
-"
,
*
e
,
e2
);
SkipToken
(
tl
,
')'
);
}
...
...
@@ -700,7 +677,7 @@ vcc_expr4(struct vcc *tl, struct expr **e, enum var_type fmt)
*/
assert
(
fmt
!=
VOID
);
if
(
fmt
==
DURATION
)
{
vcc_
RTimeVal
(
tl
,
&
d
);
vcc_
Duration
(
tl
,
&
d
);
ERRCHK
(
tl
);
e1
=
vcc_mk_expr
(
DURATION
,
"%g"
,
d
);
}
else
if
(
fmt
==
BYTES
)
{
...
...
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