Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
b28cbe90
Commit
b28cbe90
authored
Jul 24, 2018
by
antirez
Browse files
Restore string2ll() to original version.
See PR #5157.
parent
1a8d7cd9
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/util.c
View file @
b28cbe90
...
@@ -349,7 +349,12 @@ int string2ll(const char *s, size_t slen, long long *value) {
...
@@ -349,7 +349,12 @@ int string2ll(const char *s, size_t slen, long long *value) {
if
(
plen
==
slen
)
if
(
plen
==
slen
)
return
0
;
return
0
;
/* Handle negative integers. */
/* Special case: first and only digit is 0. */
if
(
slen
==
1
&&
p
[
0
]
==
'0'
)
{
if
(
value
!=
NULL
)
*
value
=
0
;
return
1
;
}
if
(
p
[
0
]
==
'-'
)
{
if
(
p
[
0
]
==
'-'
)
{
negative
=
1
;
negative
=
1
;
p
++
;
plen
++
;
p
++
;
plen
++
;
...
@@ -364,7 +369,7 @@ int string2ll(const char *s, size_t slen, long long *value) {
...
@@ -364,7 +369,7 @@ int string2ll(const char *s, size_t slen, long long *value) {
v
=
p
[
0
]
-
'0'
;
v
=
p
[
0
]
-
'0'
;
p
++
;
plen
++
;
p
++
;
plen
++
;
}
else
if
(
p
[
0
]
==
'0'
&&
slen
==
1
)
{
}
else
if
(
p
[
0
]
==
'0'
&&
slen
==
1
)
{
if
(
value
!=
NULL
)
*
value
=
0
;
*
value
=
0
;
return
1
;
return
1
;
}
else
{
}
else
{
return
0
;
return
0
;
...
...
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