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
9bb8f962
Commit
9bb8f962
authored
Feb 24, 2015
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use VNUM() rather than strtod()
parent
4f20b3dc
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
32 deletions
+34
-32
varnishadm.c
bin/varnishadm/varnishadm.c
+5
-1
varnishncsa.c
bin/varnishncsa/varnishncsa.c
+4
-6
vsl_arg.c
lib/libvarnishapi/vsl_arg.c
+6
-6
vsl_query.c
lib/libvarnishapi/vsl_query.c
+11
-10
vxp_parse.c
lib/libvarnishapi/vxp_parse.c
+8
-9
No files found.
bin/varnishadm/varnishadm.c
View file @
9bb8f962
...
...
@@ -50,6 +50,7 @@
#endif
#include <errno.h>
#include <math.h>
#include <fcntl.h>
#include <poll.h>
#include <stdint.h>
...
...
@@ -61,6 +62,7 @@
#include "vapi/vsm.h"
#include "vas.h"
#include "vcli.h"
#include "vnum.h"
#include "vss.h"
#define RL_EXIT(status) \
...
...
@@ -464,7 +466,9 @@ main(int argc, char * const *argv)
T_arg
=
optarg
;
break
;
case
't'
:
timeout
=
strtod
(
optarg
,
NULL
);
timeout
=
VNUM
(
optarg
);
if
(
isnan
(
timeout
))
usage
();
break
;
default:
usage
();
...
...
bin/varnishncsa/varnishncsa.c
View file @
9bb8f962
...
...
@@ -58,6 +58,7 @@
#include "vapi/voptget.h"
#include "vas.h"
#include "vcs.h"
#include "vnum.h"
#include "vsb.h"
#include "vut.h"
#include "vqueue.h"
...
...
@@ -283,16 +284,13 @@ static int __match_proto__(format_f)
format_time
(
const
struct
format
*
format
)
{
double
t_start
,
t_end
;
char
*
p
;
char
buf
[
64
];
time_t
t
;
struct
tm
tm
;
CHECK_OBJ_NOTNULL
(
format
,
FORMAT_MAGIC
);
if
(
CTX
.
frag
[
F_tstart
].
gen
==
CTX
.
gen
)
{
t_start
=
strtod
(
CTX
.
frag
[
F_tstart
].
b
,
&
p
);
if
(
p
!=
CTX
.
frag
[
F_tstart
].
e
)
t_start
=
NAN
;
t_start
=
VNUM
(
CTX
.
frag
[
F_tstart
].
b
);
}
else
t_start
=
NAN
;
if
(
isnan
(
t_start
))
{
...
...
@@ -305,8 +303,8 @@ format_time(const struct format *format)
/* Missing t_end defaults to t_start */
if
(
CTX
.
frag
[
F_tend
].
gen
==
CTX
.
gen
)
{
t_end
=
strtod
(
CTX
.
frag
[
F_tend
].
b
,
&
p
);
if
(
p
!=
CTX
.
frag
[
F_tend
].
e
)
t_end
=
VNUM
(
CTX
.
frag
[
F_tend
].
b
);
if
(
isnan
(
t_end
)
)
t_end
=
t_start
;
}
else
t_end
=
t_start
;
...
...
lib/libvarnishapi/vsl_arg.c
View file @
9bb8f962
...
...
@@ -36,6 +36,7 @@
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
...
...
@@ -49,6 +50,7 @@
#include "vapi/vsl.h"
#include "vapi/vsm.h"
#include "vbm.h"
#include "vnum.h"
#include "vre.h"
#include "vsl_api.h"
#include "vsm_api.h"
...
...
@@ -343,13 +345,11 @@ VSL_Arg(struct VSL_data *vsl, int opt, const char *arg)
vsl
->
L_opt
=
(
int
)
l
;
return
(
1
);
case
'T'
:
d
=
strtod
(
arg
,
&
p
);
while
(
isspace
(
*
p
))
p
++
;
if
(
*
p
!=
'\0'
)
return
(
vsl_diag
(
vsl
,
"-P: Syntax error"
));
d
=
VNUM
(
arg
);
if
(
!
isnan
(
d
))
return
(
vsl_diag
(
vsl
,
"-T: Syntax error"
));
if
(
d
<
0
.)
return
(
vsl_diag
(
vsl
,
"-
L
: Range error"
));
return
(
vsl_diag
(
vsl
,
"-
T
: Range error"
));
vsl
->
T_opt
=
d
;
return
(
1
);
case
'v'
:
vsl
->
v_opt
=
1
;
return
(
1
);
...
...
lib/libvarnishapi/vsl_query.c
View file @
9bb8f962
...
...
@@ -29,17 +29,19 @@
*/
#include <errno.h>
#include <
unistd
.h>
#include <
stdlib
.h>
#include <
ctype
.h>
#include <
math
.h>
#include <stdint.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#include "vas.h"
#include "miniobj.h"
#include "vas.h"
#include "vbm.h"
#include "vnum.h"
#include "vre.h"
#include "vsb.h"
#include "vbm.h"
#include "vapi/vsl.h"
#include "vsl_api.h"
...
...
@@ -141,11 +143,10 @@ vslq_test_rec(const struct vex *vex, const struct VSLC_ptr *rec)
/* Can't parse - no match */
return
(
0
);
case
VEX_FLOAT
:
lhs_float
=
strtod
(
b
,
&
p
);
if
(
*
p
==
'\0'
||
isspace
(
*
p
))
break
;
/* Can't parse - no match */
lhs_float
=
VNUM
(
b
);
if
(
isnan
(
lhs_float
))
return
(
0
);
break
;
default:
WRONG
(
"Wrong RHS type"
);
}
...
...
lib/libvarnishapi/vxp_parse.c
View file @
9bb8f962
...
...
@@ -30,18 +30,19 @@
#include "config.h"
#include <ctype.h>
#include <errno.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <stdint.h>
#include <string.h>
#include <ctype.h>
#include <stdint.h>
#include "miniobj.h"
#include "vas.h"
#include "vsb.h"
#include "vbm.h"
#include "miniobj.h"
#include "vnum.h"
#include "vsb.h"
#include "vapi/vsl.h"
#include "vsl_api.h"
...
...
@@ -191,10 +192,8 @@ vxp_expr_num(struct vxp *vxp, struct vex_rhs **prhs)
AN
(
*
prhs
);
if
(
strchr
(
vxp
->
t
->
dec
,
'.'
))
{
(
*
prhs
)
->
type
=
VEX_FLOAT
;
(
*
prhs
)
->
val_float
=
strtod
(
vxp
->
t
->
dec
,
&
endptr
);
while
(
isspace
(
*
endptr
))
endptr
++
;
if
(
*
endptr
!=
'\0'
)
{
(
*
prhs
)
->
val_float
=
VNUM
(
vxp
->
t
->
dec
);
if
(
isnan
((
*
prhs
)
->
val_float
))
{
VSB_printf
(
vxp
->
sb
,
"Floating point parse error "
);
vxp_ErrWhere
(
vxp
,
vxp
->
t
,
-
1
);
return
;
...
...
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