From e8f5d2194020886b39da19fc98b8a77ede516256 Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 24 Jul 2018 00:20:20 +0200 Subject: [PATCH] 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. --- src/util.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/util.c b/src/util.c index 02298e8d..e2ada556 100644 --- a/src/util.c +++ b/src/util.c @@ -349,12 +349,7 @@ int string2ll(const char *s, size_t slen, long long *value) { if (plen == slen) return 0; - /* Special case: first and only digit is 0. */ - if (slen == 1 && p[0] == '0') { - if (value != NULL) *value = 0; - return 1; - } - + /* Handle negative integers. */ if (p[0] == '-') { negative = 1; p++; plen++;