ref: c322ed13a88860fa60115775f18a07d2f10aa42a
parent: 60e5ff036844491e3ad78a4254171c218dec98c9
author: Roberto E. Vargas Caballero <[email protected]>
date: Mon Dec 31 05:32:28 EST 2018
[libc] Simplify strtol* functions Checking inside of the loop makes easier the overflow check
--- a/src/libc/stdlib/strtol.c
+++ b/src/libc/stdlib/strtol.c
@@ -46,11 +46,8 @@
if (-d < LONG_MIN - n)
goto overflow;
n -= d;
- }
-
- if (n == LONG_MIN && sign < 0) {
- --t;
- goto overflow;
+ if (n == LONG_MIN && sign < 0)
+ goto overflow;
}
if (end && t != s)
--- a/src/libc/stdlib/strtoll.c
+++ b/src/libc/stdlib/strtoll.c
@@ -46,11 +46,8 @@
if (-d < LLONG_MIN - n)
goto overflow;
n -= d;
- }
-
- if (n == LLONG_MIN && sign < 0) {
- --t;
- goto overflow;
+ if (n == LONG_MIN && sign < 0)
+ goto overflow;
}
if (end && t != s)