diff options
author | Karl Williamson <khw@cpan.org> | 2018-05-01 16:11:39 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2018-06-25 07:33:26 -0600 |
commit | 97d95d4672bf58abae274d1e5194e87305eb9bac (patch) | |
tree | a0ac6636f2f03bfb637182d29fe2eb9c7085e997 /numeric.c | |
parent | 5d4a52b5c68a11bfc97c2e24806993b84a61eade (diff) | |
download | perl-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.c | 34 |
1 files changed, 18 insertions, 16 deletions
@@ -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; } |