This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Move some more code to earlier
authorKarl Williamson <khw@cpan.org>
Sat, 13 Oct 2018 06:37:45 +0000 (00:37 -0600)
committerKarl Williamson <khw@cpan.org>
Sat, 20 Oct 2018 06:09:55 +0000 (00:09 -0600)
It is better defensive coding to restore as soon as possible, rather
than deferring it.

regcomp.c

index 17d87b6..47a5c90 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -16108,6 +16108,10 @@ redo_curchar:
     SvREFCNT_dec_NN(final);
     SvREFCNT_dec_NN(result_string);
 
+    if (save_fold) {
+        RExC_flags |= RXf_PMf_FOLD;
+    }
+
     if (!node)
         FAIL2("panic: regclass returned failure to handle_sets, flags=%#" UVxf,
                     PTR2UV(flagp));
@@ -16138,10 +16142,6 @@ redo_curchar:
                 |= ANYOFL_SHARED_UTF8_LOCALE_fold_HAS_MATCHES_nonfold_REQD;
     }
 
-    if (save_fold) {
-        RExC_flags |= RXf_PMf_FOLD;
-    }
-
     nextchar(pRExC_state);
     Set_Node_Length(REGNODE_p(node), RExC_parse - oregcomp_parse + 1); /* MJD */
     return node;