This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix typo
[perl5.git] / scope.c
diff --git a/scope.c b/scope.c
index 1e06671..20e027f 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -509,6 +509,17 @@ Perl_save_delete(pTHX_ HV *hv, char *key, I32 klen)
 }
 
 void
+Perl_save_adelete(pTHX_ AV *av, I32 key)
+{
+    dVAR;
+
+    PERL_ARGS_ASSERT_SAVE_ADELETE;
+
+    SvREFCNT_inc_void(av);
+    save_pushi32ptr(key, av, SAVEt_ADELETE);
+}
+
+void
 Perl_save_destructor(pTHX_ DESTRUCTORFUNC_NOCONTEXT_t f, void* p)
 {
     dVAR;
@@ -648,6 +659,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");
@@ -862,6 +875,13 @@ Perl_leave_scope(pTHX_ I32 base)
            SvREFCNT_dec(hv);
            Safefree(ptr);
            break;
+       case SAVEt_ADELETE:
+           ptr = SSPOPPTR;
+           av = MUTABLE_AV(ptr);
+           i = SSPOPINT;
+           (void)av_delete(av, i, G_DISCARD);
+           SvREFCNT_dec(av);
+           break;
        case SAVEt_DESTRUCTOR_X:
            ptr = SSPOPPTR;
            (*SSPOPDXPTR)(aTHX_ ptr);
@@ -1065,6 +1085,8 @@ Perl_leave_scope(pTHX_ I32 base)
            Perl_croak(aTHX_ "panic: leave_scope inconsistency");
        }
     }
+
+    PL_tainted = was;
 }
 
 void