This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make \N{unknown char} a syntax error
[perl5.git] / scope.c
diff --git a/scope.c b/scope.c
index c3025f8..c767571 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -160,8 +160,10 @@ Perl_free_tmps(pTHX)
     /* XXX should tmps_floor live in cxstack? */
     const I32 myfloor = PL_tmps_floor;
     while (PL_tmps_ix > myfloor) {      /* clean up after last statement */
-       SV* const sv = PL_tmps_stack[PL_tmps_ix];
-       PL_tmps_stack[PL_tmps_ix--] = NULL;
+       SV* const sv = PL_tmps_stack[PL_tmps_ix--];
+#ifdef PERL_POISON
+       PoisonWith(PL_tmps_stack + PL_tmps_ix + 1, 1, SV *, 0xAB);
+#endif
        if (sv && sv != &PL_sv_undef) {
            SvTEMP_off(sv);
            SvREFCNT_dec(sv);           /* note, can modify tmps_ix!!! */
@@ -955,8 +957,6 @@ Perl_leave_scope(pTHX_ I32 base)
                case SVt_PVCV:
                {
                    SV ** const svp = (SV **)ptr;
-                   MAGIC *mg = SvMAGIC(sv);
-                   MAGIC **tomg = &SvMAGIC(sv);
 
                    /* Create a stub */
                    *svp = newSV_type(SVt_PVCV);
@@ -965,18 +965,6 @@ Perl_leave_scope(pTHX_ I32 base)
                    assert(CvNAMED(sv));
                    CvNAME_HEK_set(*svp,
                        share_hek_hek(CvNAME_HEK((CV *)sv)));
-
-                   /* Steal magic */
-                   while (mg) {
-                       if (mg->mg_type == PERL_MAGIC_proto) break;
-                       mg = *(tomg = &mg->mg_moremagic);
-                   }
-                   assert(mg);
-                   *tomg = mg->mg_moremagic;
-                   mg->mg_moremagic = SvMAGIC(*svp);
-                   SvMAGIC(*svp) = mg;
-                   mg_magical(*svp);
-                   mg_magical(sv);
                    break;
                }
                default:        *(SV**)ptr = newSV(0);          break;
@@ -1090,7 +1078,6 @@ Perl_leave_scope(pTHX_ I32 base)
                PL_curpad = AvARRAY(PL_comppad);
            else
                PL_curpad = NULL;
-           PL_comppad_name = (PADNAMELIST*)SSPOPPTR;
            break;
        case SAVEt_PADSV_AND_MORTALIZE:
            {
@@ -1205,6 +1192,7 @@ Perl_cx_dump(pTHX_ PERL_CONTEXT *cx)
 #ifdef DEBUGGING
     PerlIO_printf(Perl_debug_log, "CX %ld = %s\n", (long)(cx - cxstack), PL_block_type[CxTYPE(cx)]);
     if (CxTYPE(cx) != CXt_SUBST) {
+       const char *gimme_text;
        PerlIO_printf(Perl_debug_log, "BLK_OLDSP = %ld\n", (long)cx->blk_oldsp);
        PerlIO_printf(Perl_debug_log, "BLK_OLDCOP = 0x%"UVxf"\n",
                      PTR2UV(cx->blk_oldcop));
@@ -1212,7 +1200,21 @@ Perl_cx_dump(pTHX_ PERL_CONTEXT *cx)
        PerlIO_printf(Perl_debug_log, "BLK_OLDSCOPESP = %ld\n", (long)cx->blk_oldscopesp);
        PerlIO_printf(Perl_debug_log, "BLK_OLDPM = 0x%"UVxf"\n",
                      PTR2UV(cx->blk_oldpm));
-       PerlIO_printf(Perl_debug_log, "BLK_GIMME = %s\n", cx->blk_gimme ? "LIST" : "SCALAR");
+       switch (cx->blk_gimme) {
+           case G_VOID:
+               gimme_text = "VOID";
+               break;
+           case G_SCALAR:
+               gimme_text = "SCALAR";
+               break;
+           case G_ARRAY:
+               gimme_text = "LIST";
+               break;
+           default:
+               gimme_text = "UNKNOWN";
+               break;
+       }
+       PerlIO_printf(Perl_debug_log, "BLK_GIMME = %s\n", gimme_text);
     }
     switch (CxTYPE(cx)) {
     case CXt_NULL: