Teach regex optimiser how to handle (?=) and (?<=) properly.
[p5sagit/p5-mst-13.2.git] / scope.c
diff --git a/scope.c b/scope.c
index 33763a7..6365f2d 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -267,9 +267,7 @@ Perl_save_gp(pTHX_ GV *gv, I32 empty)
     SSPUSHINT(SAVEt_GP);
 
     if (empty) {
-       register GP *gp;
-
-       Newxz(gp, 1, GP);
+       GP *gp = Perl_newGP(aTHX_ gv);
 
        if (GvCVu(gv))
            PL_sub_generation++;        /* taking a method out of circulation */
@@ -277,15 +275,7 @@ Perl_save_gp(pTHX_ GV *gv, I32 empty)
            gp->gp_io = newIO();
            IoFLAGS(gp->gp_io) |= IOf_ARGV|IOf_START;
        }
-       GvGP(gv) = gp_ref(gp);
-#ifndef PERL_DONT_CREATE_GVSV
-       GvSV(gv) = newSV(0);
-#endif
-       GvLINE(gv) = CopLINE(PL_curcop);
-       /* XXX Ideally this cast would be replaced with a change to const char*
-          in the struct.  */
-       GvFILE(gv) = CopFILE(PL_curcop) ? CopFILE(PL_curcop) : (char *) "";
-       GvEGV(gv) = gv;
+       GvGP(gv) = gp;
     }
     else {
        gp_ref(GvGP(gv));
@@ -845,9 +835,9 @@ Perl_leave_scope(pTHX_ I32 base)
            value = (SV*)SSPOPPTR;
            i = SSPOPINT;
            av = (AV*)SSPOPPTR;
+           ptr = av_fetch(av,i,1);
            if (!AvREAL(av) && AvREIFY(av)) /* undo reify guard */
                SvREFCNT_dec(value);
-           ptr = av_fetch(av,i,1);
            if (ptr) {
                sv = *(SV**)ptr;
                if (sv && sv != &PL_sv_undef) {
@@ -888,8 +878,8 @@ Perl_leave_scope(pTHX_ I32 base)
                GvHV(PL_hintgv) = NULL;
            }
            *(I32*)&PL_hints = (I32)SSPOPINT;
-           Perl_refcounted_he_free(aTHX_ PL_compiling.cop_hints);
-           PL_compiling.cop_hints = (struct refcounted_he *) SSPOPPTR;
+           Perl_refcounted_he_free(aTHX_ PL_compiling.cop_hints_hash);
+           PL_compiling.cop_hints_hash = (struct refcounted_he *) SSPOPPTR;
            if (PL_hints & HINT_LOCALIZE_HH) {
                SvREFCNT_dec((SV*)GvHV(PL_hintgv));
                GvHV(PL_hintgv) = (HV*)SSPOPPTR;
@@ -990,7 +980,7 @@ Perl_leave_scope(pTHX_ I32 base)
            if (!specialWARN(PL_compiling.cop_warnings))
                PerlMemShared_free(PL_compiling.cop_warnings);
 
-           PL_compiling.cop_warnings = ptr;
+           PL_compiling.cop_warnings = (STRLEN*)ptr;
            break;
        case SAVEt_RE_STATE:
            {
@@ -1043,7 +1033,7 @@ Perl_cx_dump(pTHX_ PERL_CONTEXT *cx)
        PerlIO_printf(Perl_debug_log, "BLK_SUB.DFOUTGV = 0x%"UVxf"\n",
                PTR2UV(cx->blk_sub.dfoutgv));
        PerlIO_printf(Perl_debug_log, "BLK_SUB.HASARGS = %d\n",
-               (int)cx->blk_sub.hasargs);
+               (int)CX_SUB_HASARGS_GET(cx));
        PerlIO_printf(Perl_debug_log, "BLK_SUB.RETOP = 0x%"UVxf"\n",
                PTR2UV(cx->blk_sub.retop));
        break;
@@ -1053,9 +1043,9 @@ Perl_cx_dump(pTHX_ PERL_CONTEXT *cx)
        PerlIO_printf(Perl_debug_log, "BLK_SUB.OLDDEPTH = %ld\n",
                (long)cx->blk_sub.olddepth);
        PerlIO_printf(Perl_debug_log, "BLK_SUB.HASARGS = %d\n",
-               (int)cx->blk_sub.hasargs);
+               (int)CX_SUB_HASARGS_GET(cx));
        PerlIO_printf(Perl_debug_log, "BLK_SUB.LVAL = %d\n",
-               (int)cx->blk_sub.lval);
+               (int)CX_SUB_LVAL(cx));
        PerlIO_printf(Perl_debug_log, "BLK_SUB.RETOP = 0x%"UVxf"\n",
                PTR2UV(cx->blk_sub.retop));
        break;