make make_patchnum.sh (more) portable
[p5sagit/p5-mst-13.2.git] / scope.c
diff --git a/scope.c b/scope.c
index 6782e0b..cad14de 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -540,7 +540,6 @@ Perl_save_hints(pTHX)
            PL_compiling.cop_hints_hash->refcounted_he_refcnt++;
            HINTS_REFCNT_UNLOCK;
     }
-    SSCHECK(4);
     if (PL_hints & HINT_LOCALIZE_HH) {
        save_pushptri32ptr(GvHV(PL_hintgv), PL_hints,
                           PL_compiling.cop_hints_hash, SAVEt_HINTS);
@@ -649,6 +648,8 @@ Perl_leave_scope(pTHX_ I32 base)
     void* ptr;
     register char* str;
     I32 i;
+    /* Localise the effects of the TAINT_NOT inside the loop.  */
+    const bool was = PL_tainted;
 
     if (base < -1)
        Perl_croak(aTHX_ "panic: corrupt saved stack index");
@@ -903,19 +904,18 @@ Perl_leave_scope(pTHX_ I32 base)
            sv = MUTABLE_SV(SSPOPPTR);
            hv = MUTABLE_HV(SSPOPPTR);
            ptr = hv_fetch_ent(hv, sv, 1, 0);
+           SvREFCNT_dec(sv);
            if (ptr) {
                const SV * const oval = HeVAL((HE*)ptr);
                if (oval && oval != &PL_sv_undef) {
                    ptr = &HeVAL((HE*)ptr);
                    if (SvTIED_mg((const SV *)hv, PERL_MAGIC_tied))
                        SvREFCNT_inc_void(*(SV**)ptr);
-                   SvREFCNT_dec(sv);
                    av = MUTABLE_AV(hv); /* what to refcnt_dec */
                    goto restore_sv;
                }
            }
            SvREFCNT_dec(hv);
-           SvREFCNT_dec(sv);
            SvREFCNT_dec(value);
            break;
        case SAVEt_OP:
@@ -1067,6 +1067,8 @@ Perl_leave_scope(pTHX_ I32 base)
            Perl_croak(aTHX_ "panic: leave_scope inconsistency");
        }
     }
+
+    PL_tainted = was;
 }
 
 void