Localize PL_reg_state during re_evals
authorFlorian Ragwitz <rafl@debian.org>
Sun, 19 Sep 2010 23:17:34 +0000 (01:17 +0200)
committerFlorian Ragwitz <rafl@debian.org>
Wed, 29 Sep 2010 18:14:03 +0000 (20:14 +0200)
regexec.c

index 881f8c2..867965a 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -3975,7 +3975,10 @@ S_regmatch(pTHX_ regmatch_info *reginfo, regnode *prog)
                COP * const ocurcop = PL_curcop;
                PAD *old_comppad;
                char *saved_regeol = PL_regeol;
-           
+               struct re_save_state saved_state;
+
+               Copy(&PL_reg_state, &saved_state, 1, struct re_save_state);
+
                n = ARG(scan);
                PL_op = (OP_4tree*)rexi->data->data[n];
                DEBUG_STATE_r( PerlIO_printf(Perl_debug_log, 
@@ -3997,6 +4000,8 @@ S_regmatch(pTHX_ regmatch_info *reginfo, regnode *prog)
                    PUTBACK;
                }
 
+               Copy(&saved_state, &PL_reg_state, 1, struct re_save_state);
+
                PL_op = oop;
                PAD_RESTORE_LOCAL(old_comppad);
                PL_curcop = ocurcop;