string2ll(): remove duplicated check for special case.

Related to #5157. The PR author correctly indentified that the check was
duplicated, but removing the second one introduces a bug that was fixed
in the past (hence the duplication). Instead we can remove the first
instance of the check without issues.
This commit is contained in:
antirez 2018-07-24 00:20:20 +02:00
parent 1daee8c748
commit e8f5d21940

View File

@ -349,12 +349,7 @@ int string2ll(const char *s, size_t slen, long long *value) {
if (plen == slen) if (plen == slen)
return 0; return 0;
/* Special case: first and only digit is 0. */ /* Handle negative integers. */
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++;