summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2018-05-01 16:11:39 -0600
committerKarl Williamson <khw@cpan.org>2018-06-25 07:33:26 -0600
commit97d95d4672bf58abae274d1e5194e87305eb9bac (patch)
treea0ac6636f2f03bfb637182d29fe2eb9c7085e997 /numeric.c
parent5d4a52b5c68a11bfc97c2e24806993b84a61eade (diff)
downloadperl-97d95d4672bf58abae274d1e5194e87305eb9bac.tar.gz
numeric.c: White-space only
Outdent after the previous commit removed an enclosing block
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/numeric.c b/numeric.c
index e71ab39293..34eb8b3f30 100644
--- a/numeric.c
+++ b/numeric.c
@@ -1110,25 +1110,26 @@ Perl_grok_atoUV(const char *pv, UV *valptr, const char** endptr)
return FALSE;
}
- /* Single-digit inputs are quite common. */
- val = *s++ - '0';
- if (s < *eptr && isDIGIT(*s)) {
- /* Fail on extra leading zeros. */
- if (val == 0)
+ /* Single-digit inputs are quite common. */
+ val = *s++ - '0';
+ if (s < *eptr && isDIGIT(*s)) {
+ /* Fail on extra leading zeros. */
+ if (val == 0)
+ return FALSE;
+ while (s < *eptr && isDIGIT(*s)) {
+ /* This could be unrolled like in grok_number(), but
+ * the expected uses of this are not speed-needy, and
+ * unlikely to need full 64-bitness. */
+ const U8 digit = *s++ - '0';
+ if (val < uv_max_div_10 ||
+ (val == uv_max_div_10 && digit <= uv_max_mod_10)) {
+ val = val * 10 + digit;
+ } else {
return FALSE;
- while (s < *eptr && isDIGIT(*s)) {
- /* This could be unrolled like in grok_number(), but
- * the expected uses of this are not speed-needy, and
- * unlikely to need full 64-bitness. */
- const U8 digit = *s++ - '0';
- if (val < uv_max_div_10 ||
- (val == uv_max_div_10 && digit <= uv_max_mod_10)) {
- val = val * 10 + digit;
- } else {
- return FALSE;
- }
}
}
+ }
+
if (endptr == NULL) {
if (*s) {
return FALSE; /* If endptr is NULL, no trailing non-digits allowed. */
@@ -1137,6 +1138,7 @@ Perl_grok_atoUV(const char *pv, UV *valptr, const char** endptr)
else {
*endptr = s;
}
+
*valptr = val;
return TRUE;
}