By swapping the order of pushes onto the save stack for
[p5sagit/p5-mst-13.2.git] / regcomp.c
index 3e939df..9ec5784 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -6167,50 +6167,29 @@ void
 Perl_save_re_context(pTHX)
 {
     dVAR;
-    SAVEI32(PL_reg_flags);             /* from regexec.c */
-    SAVEPPTR(PL_bostr);
-    SAVEPPTR(PL_reginput);             /* String-input pointer. */
-    SAVEPPTR(PL_regbol);               /* Beginning of input, for ^ check. */
-    SAVEPPTR(PL_regeol);               /* End of input, for $ check. */
-    SAVEVPTR(PL_regstartp);            /* Pointer to startp array. */
-    SAVEVPTR(PL_regendp);              /* Ditto for endp. */
-    SAVEVPTR(PL_reglastparen);         /* Similarly for lastparen. */
-    SAVEVPTR(PL_reglastcloseparen);    /* Similarly for lastcloseparen. */
-    SAVEPPTR(PL_regtill);              /* How far we are required to go. */
-    SAVEGENERICPV(PL_reg_start_tmp);           /* from regexec.c */
+
+    struct re_save_state *state;
+
+    SAVEVPTR(PL_curcop);
+    SSGROW(SAVESTACK_ALLOC_FOR_RE_SAVE_STATE + 1);
+
+    state = (struct re_save_state *)(PL_savestack + PL_savestack_ix);
+    PL_savestack_ix += SAVESTACK_ALLOC_FOR_RE_SAVE_STATE;
+    SSPUSHINT(SAVEt_RE_STATE);
+
+    Copy(&PL_reg_state, state, 1, struct re_save_state);
+
     PL_reg_start_tmp = 0;
-    SAVEI32(PL_reg_start_tmpl);                /* from regexec.c */
     PL_reg_start_tmpl = 0;
-    SAVEI32(PL_reg_eval_set);          /* from regexec.c */
-    SAVEI32(PL_regnarrate);            /* from regexec.c */
-    SAVEINT(PL_regindent);             /* from regexec.c */
-    SAVEVPTR(PL_curcop);
-    SAVEVPTR(PL_reg_call_cc);          /* from regexec.c */
-    SAVEVPTR(PL_reg_re);               /* from regexec.c */
-    SAVEPPTR(PL_reg_ganch);            /* from regexec.c */
-    SAVESPTR(PL_reg_sv);               /* from regexec.c */
-    SAVEBOOL(PL_reg_match_utf8);       /* from regexec.c */
-    SAVEVPTR(PL_reg_magic);            /* from regexec.c */
-    SAVEI32(PL_reg_oldpos);                    /* from regexec.c */
-    SAVEVPTR(PL_reg_oldcurpm);         /* from regexec.c */
-    SAVEVPTR(PL_reg_curpm);            /* from regexec.c */
-    SAVEPPTR(PL_reg_oldsaved);         /* old saved substr during match */
     PL_reg_oldsaved = NULL;
-    SAVEI32(PL_reg_oldsavedlen);       /* old length of saved substr during match */
     PL_reg_oldsavedlen = 0;
-#ifdef PERL_OLD_COPY_ON_WRITE
-    SAVESPTR(PL_nrs);
-    PL_nrs = NULL;
-#endif
-    SAVEI32(PL_reg_maxiter);           /* max wait until caching pos */
     PL_reg_maxiter = 0;
-    SAVEI32(PL_reg_leftiter);          /* wait until caching pos */
     PL_reg_leftiter = 0;
-    SAVEGENERICPV(PL_reg_poscache);    /* cache of pos of WHILEM */
     PL_reg_poscache = NULL;
-    SAVEI32(PL_reg_poscache_size);     /* size of pos cache of WHILEM */
     PL_reg_poscache_size = 0;
-    SAVEI32(PL_regsize);               /* from regexec.c */
+#ifdef PERL_OLD_COPY_ON_WRITE
+    PL_nrs = NULL;
+#endif
 
     /* Save $1..$n (#18107: UTF-8 s/(\w+)/uc($1)/e); AMS 20021106. */
     if (PL_curpm) {
@@ -6231,10 +6210,6 @@ Perl_save_re_context(pTHX)
            }
        }
     }
-
-#ifdef DEBUGGING
-    SAVEPPTR(PL_reg_starttry);         /* from regexec.c */
-#endif
 }
 
 static void