This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Perl_sv_vcatpvfn_flags: tighten hexfp var scope
authorDavid Mitchell <davem@iabyn.com>
Thu, 18 May 2017 10:32:27 +0000 (11:32 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 7 Jun 2017 08:11:02 +0000 (09:11 +0100)
Only have the 'hexfp' var declared within the innermost scope it is
actually needed for.

sv.c

diff --git a/sv.c b/sv.c
index 5562a24..261de4c 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -11790,7 +11790,6 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p
      * Plus 32: Playing safe. */
     char ebuf[IV_DIG * 4 + NV_DIG + 32];
     bool no_redundant_warning = FALSE; /* did we use any explicit format parameter index? */
-    bool hexfp = FALSE; /* hexadecimal floating point? */
 
     DECLARATION_FOR_LC_NUMERIC_MANIPULATION;
 
@@ -12621,6 +12620,7 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p
             bool   can_be_special; /* candidate for special-case-handling */
             STRLEN radix_len;  /* SvCUR(PL_numeric_radix_sv) */
             STRLEN float_need; /* what PL_efloatsize needs to become */
+            bool hexfp;        /* hexadecimal floating point? */
 
             vcatpvfn_long_double_t fv;
             NV                     nv;
@@ -12786,6 +12786,8 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p
              */
            float_need += radix_len;
 
+            hexfp = FALSE;
+
            if (isALPHA_FOLD_EQ(c, 'f')) {
                 /* Determine how many digits before the radix point
                  * might be emitted.  frexp() (or frexpl) has some