mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 09:00:51 +00:00
parent
1a8d7cd9c2
commit
b28cbe90e1
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user