diff options
author | Andy Lester <andy@petdance.com> | 2016-09-30 10:20:47 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2016-10-18 22:21:30 -0600 |
commit | 7eff3d39584e66495e9104149bc4f73e65307c84 (patch) | |
tree | d316f451d2174c0e5ada6147764107406b69f20d /numeric.c | |
parent | 773d126d349e75a61bbc0b116e6048aaa9a48fc1 (diff) | |
download | perl-7eff3d39584e66495e9104149bc4f73e65307c84.tar.gz |
PATCH: [perl #129766] Internal cleanup in numeric.c
No functional changes
Diffstat (limited to 'numeric.c')
-rw-r--r-- | numeric.c | 20 |
1 files changed, 8 insertions, 12 deletions
@@ -1022,7 +1022,7 @@ Perl_grok_number_flags(pTHX_ const char *pv, STRLEN len, UV *valuep, U32 flags) if ((s + 2 < send) && strchr("inqs#", toFOLD(*s))) { /* Really detect inf/nan. Start at d, not s, since the above * code might have already consumed the "1." or "1". */ - int infnan = Perl_grok_infnan(aTHX_ &d, send); + const int infnan = Perl_grok_infnan(aTHX_ &d, send); if ((infnan & IS_NUMBER_INFINITY)) { return (numtype | infnan); /* Keep sign for infinity. */ } @@ -1089,7 +1089,7 @@ Perl_grok_atoUV(const char *pv, UV *valptr, const char** endptr) /* 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. */ - U8 digit = *s++ - '0'; + 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; @@ -1221,9 +1221,6 @@ Perl_my_atof(pTHX_ const char* s) DECLARATION_FOR_LC_NUMERIC_MANIPULATION; STORE_LC_NUMERIC_SET_TO_NEEDED(); if (PL_numeric_radix_sv && IN_LC(LC_NUMERIC)) { - const char *standard = NULL, *local = NULL; - bool use_standard_radix; - /* Look through the string for the first thing that looks like a * decimal point: either the value in the current locale or the * standard fallback of '.'. The one which appears earliest in the @@ -1231,10 +1228,9 @@ Perl_my_atof(pTHX_ const char* s) * that we have to determine this beforehand because on some * systems, Perl_atof2 is just a wrapper around the system's atof. * */ - standard = strchr(s, '.'); - local = strstr(s, SvPV_nolen(PL_numeric_radix_sv)); - - use_standard_radix = standard && (!local || standard < local); + const char * const standard = strchr(s, '.'); + const char * const local = strstr(s, SvPV_nolen(PL_numeric_radix_sv)); + const bool use_standard_radix = standard && (!local || standard < local); if (use_standard_radix) SET_NUMERIC_STANDARD(); @@ -1266,7 +1262,7 @@ S_my_atof_infnan(pTHX_ const char* s, bool negative, const char* send, NV* value { const char *p0 = negative ? s - 1 : s; const char *p = p0; - int infnan = grok_infnan(&p, send); + const int infnan = grok_infnan(&p, send); if (infnan && p != p0) { /* If we can generate inf/nan directly, let's do so. */ #ifdef NV_INF @@ -1428,9 +1424,9 @@ Perl_my_atof2(pTHX_ const char* orig, NV* value) #if defined(NV_INF) || defined(NV_NAN) { - const char* endp; + char* endp; if ((endp = S_my_atof_infnan(aTHX_ s, negative, send, value))) - return (char*)endp; + return endp; } #endif |