POD: Use F<> for F<utils/perldoc> and F<utils/perldoc.PL>
[p5sagit/p5-mst-13.2.git] / scope.c
diff --git a/scope.c b/scope.c
index 50798e4..6ee1254 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -91,7 +91,13 @@ Perl_push_scope(pTHX)
     if (PL_scopestack_ix == PL_scopestack_max) {
        PL_scopestack_max = GROW(PL_scopestack_max);
        Renew(PL_scopestack, PL_scopestack_max, I32);
+#ifdef DEBUGGING
+       Renew(PL_scopestack_name, PL_scopestack_max, const char*);
+#endif
     }
+#ifdef DEBUGGING
+    PL_scopestack_name[PL_scopestack_ix] = "unknown";
+#endif
     PL_scopestack[PL_scopestack_ix++] = PL_savestack_ix;
 
 }
@@ -613,7 +619,7 @@ Perl_save_aelem_flags(pTHX_ AV *av, I32 idx, SV **sptr, const U32 flags)
      * won't actually be stored in the array - so it won't get
      * reaped when the localize ends. Ensure it gets reaped by
      * mortifying it instead. DAPM */
-    if (SvTIED_mg(sv, PERL_MAGIC_tiedelem))
+    if (SvTIED_mg((const SV *)av, PERL_MAGIC_tied))
        sv_2mortal(sv);
 }
 
@@ -639,7 +645,7 @@ Perl_save_helem_flags(pTHX_ HV *hv, SV *key, SV **sptr, const U32 flags)
      * won't actually be stored in the hash - so it won't get
      * reaped when the localize ends. Ensure it gets reaped by
      * mortifying it instead. DAPM */
-    if (SvTIED_mg(sv, PERL_MAGIC_tiedelem))
+    if (SvTIED_mg((const SV *)hv, PERL_MAGIC_tied))
        sv_2mortal(sv);
 }
 
@@ -688,6 +694,8 @@ Perl_leave_scope(pTHX_ I32 base)
 
     if (base < -1)
        Perl_croak(aTHX_ "panic: corrupt saved stack index");
+    DEBUG_l(Perl_deb(aTHX_ "savestack: releasing items %ld -> %ld\n",
+                       (long)PL_savestack_ix, (long)base));
     while (PL_savestack_ix > base) {
        TAINT_NOT;
 
@@ -747,9 +755,7 @@ Perl_leave_scope(pTHX_ I32 base)
        case SAVEt_AV:                          /* array reference */
            av = MUTABLE_AV(SSPOPPTR);
            gv = MUTABLE_GV(SSPOPPTR);
-           if (GvAV(gv)) {
-               SvREFCNT_dec(GvAV(gv));
-           }
+           SvREFCNT_dec(GvAV(gv));
            GvAV(gv) = av;
            if (SvMAGICAL(av)) {
                PL_localizing = 2;
@@ -760,9 +766,7 @@ Perl_leave_scope(pTHX_ I32 base)
        case SAVEt_HV:                          /* hash reference */
            hv = MUTABLE_HV(SSPOPPTR);
            gv = MUTABLE_GV(SSPOPPTR);
-           if (GvHV(gv)) {
-               SvREFCNT_dec(GvHV(gv));
-           }
+           SvREFCNT_dec(GvHV(gv));
            GvHV(gv) = hv;
            if (SvMAGICAL(hv)) {
                PL_localizing = 2;
@@ -776,7 +780,7 @@ Perl_leave_scope(pTHX_ I32 base)
            break;
        case SAVEt_BOOL:                        /* bool reference */
            ptr = SSPOPPTR;
-           *(bool*)ptr = (bool)SSPOPBOOL;
+           *(bool*)ptr = cBOOL(SSPOPBOOL);
            break;
        case SAVEt_I32:                         /* I32 reference */
            ptr = SSPOPPTR;
@@ -1111,6 +1115,8 @@ Perl_leave_scope(pTHX_ I32 base)
     }
 
     PL_tainted = was;
+
+    PERL_ASYNC_CHECK();
 }
 
 void