Commit b28cbe90 authored by antirez's avatar antirez
Browse files

Restore string2ll() to original version.

See PR #5157.
parent 1a8d7cd9
......@@ -349,7 +349,12 @@ int string2ll(const char *s, size_t slen, long long *value) {
if (plen == slen)
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] == '-') {
negative = 1;
p++; plen++;
......@@ -364,7 +369,7 @@ int string2ll(const char *s, size_t slen, long long *value) {
v = p[0]-'0';
p++; plen++;
} else if (p[0] == '0' && slen == 1) {
if (value != NULL) *value = 0;
*value = 0;
return 1;
} else {
return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment