Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
682c73e8
Commit
682c73e8
authored
Apr 16, 2010
by
Pieter Noordhuis
Browse files
check eptr inline
parent
bd79a6bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
redis.c
View file @
682c73e8
...
@@ -3106,7 +3106,7 @@ static size_t stringObjectLen(robj *o) {
...
@@ -3106,7 +3106,7 @@ static size_t stringObjectLen(robj *o) {
static
int
getDoubleFromObject
(
robj
*
o
,
double
*
target
)
{
static
int
getDoubleFromObject
(
robj
*
o
,
double
*
target
)
{
double
value
;
double
value
;
char
*
eptr
=
NULL
;
char
*
eptr
;
if
(
o
==
NULL
)
{
if
(
o
==
NULL
)
{
value
=
0
;
value
=
0
;
...
@@ -3114,6 +3114,7 @@ static int getDoubleFromObject(robj *o, double *target) {
...
@@ -3114,6 +3114,7 @@ static int getDoubleFromObject(robj *o, double *target) {
redisAssert
(
o
->
type
==
REDIS_STRING
);
redisAssert
(
o
->
type
==
REDIS_STRING
);
if
(
o
->
encoding
==
REDIS_ENCODING_RAW
)
{
if
(
o
->
encoding
==
REDIS_ENCODING_RAW
)
{
value
=
strtod
(
o
->
ptr
,
&
eptr
);
value
=
strtod
(
o
->
ptr
,
&
eptr
);
if
(
eptr
[
0
]
!=
'\0'
)
return
REDIS_ERR
;
}
else
if
(
o
->
encoding
==
REDIS_ENCODING_INT
)
{
}
else
if
(
o
->
encoding
==
REDIS_ENCODING_INT
)
{
value
=
(
long
)
o
->
ptr
;
value
=
(
long
)
o
->
ptr
;
}
else
{
}
else
{
...
@@ -3121,10 +3122,6 @@ static int getDoubleFromObject(robj *o, double *target) {
...
@@ -3121,10 +3122,6 @@ static int getDoubleFromObject(robj *o, double *target) {
}
}
}
}
if
(
eptr
!=
NULL
&&
eptr
[
0
]
!=
'\0'
)
{
return
REDIS_ERR
;
}
*
target
=
value
;
*
target
=
value
;
return
REDIS_OK
;
return
REDIS_OK
;
}
}
...
@@ -3146,7 +3143,7 @@ static int getDoubleFromObjectOrReply(redisClient *c, robj *o, double *target, c
...
@@ -3146,7 +3143,7 @@ static int getDoubleFromObjectOrReply(redisClient *c, robj *o, double *target, c
static
int
getLongLongFromObject
(
robj
*
o
,
long
long
*
target
)
{
static
int
getLongLongFromObject
(
robj
*
o
,
long
long
*
target
)
{
long
long
value
;
long
long
value
;
char
*
eptr
=
NULL
;
char
*
eptr
;
if
(
o
==
NULL
)
{
if
(
o
==
NULL
)
{
value
=
0
;
value
=
0
;
...
@@ -3154,6 +3151,7 @@ static int getLongLongFromObject(robj *o, long long *target) {
...
@@ -3154,6 +3151,7 @@ static int getLongLongFromObject(robj *o, long long *target) {
redisAssert
(
o
->
type
==
REDIS_STRING
);
redisAssert
(
o
->
type
==
REDIS_STRING
);
if
(
o
->
encoding
==
REDIS_ENCODING_RAW
)
{
if
(
o
->
encoding
==
REDIS_ENCODING_RAW
)
{
value
=
strtoll
(
o
->
ptr
,
&
eptr
,
10
);
value
=
strtoll
(
o
->
ptr
,
&
eptr
,
10
);
if
(
eptr
[
0
]
!=
'\0'
)
return
REDIS_ERR
;
}
else
if
(
o
->
encoding
==
REDIS_ENCODING_INT
)
{
}
else
if
(
o
->
encoding
==
REDIS_ENCODING_INT
)
{
value
=
(
long
)
o
->
ptr
;
value
=
(
long
)
o
->
ptr
;
}
else
{
}
else
{
...
@@ -3161,10 +3159,6 @@ static int getLongLongFromObject(robj *o, long long *target) {
...
@@ -3161,10 +3159,6 @@ static int getLongLongFromObject(robj *o, long long *target) {
}
}
}
}
if
(
eptr
!=
NULL
&&
eptr
[
0
]
!=
'\0'
)
{
return
REDIS_ERR
;
}
*
target
=
value
;
*
target
=
value
;
return
REDIS_OK
;
return
REDIS_OK
;
}
}
...
...
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