regcomp.c: Move code out of longjump area
authorKarl Williamson <public@khwilliamson.com>
Fri, 3 Dec 2010 15:54:37 +0000 (08:54 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 4 Dec 2010 19:42:49 +0000 (11:42 -0800)
This code should be done before the setjump to avoid the longjump
clobbering it.

regcomp.c

index 59f11f5..5bc77ec 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -4418,6 +4418,12 @@ Perl_re_compile(pTHX_ SV * const pattern, U32 pm_flags)
     /* ignore the utf8ness if the string is 0 length */
     RExC_utf8 = RExC_orig_utf8 = plen > 0 && SvUTF8(pattern);
 
+    /* Set to use unicode semantics if the pattern is in utf8 and has the
+     * 'dual' charset specified, as it means unicode when utf8  */
+    if (RExC_utf8  && ! (pm_flags & (RXf_PMf_LOCALE|RXf_PMf_UNICODE))) {
+       pm_flags |= RXf_PMf_UNICODE;
+    }
+
     /****************** LONG JUMP TARGET HERE***********************/
     /* Longjmp back to here if have to switch in midstream to utf8 */
     if (! RExC_orig_utf8) {
@@ -4465,12 +4471,6 @@ Perl_re_compile(pTHX_ SV * const pattern, U32 pm_flags)
     restudied = 0;
 #endif
 
-    /* Set to use unicode semantics if the pattern is in utf8 and has the
-     * 'dual' charset specified, as it means unicode when utf8  */
-    if (RExC_utf8  && ! (pm_flags & (RXf_PMf_LOCALE|RXf_PMf_UNICODE))) {
-       pm_flags |= RXf_PMf_UNICODE;
-    }
-
     RExC_precomp = exp;
     RExC_flags = pm_flags;
     RExC_sawback = 0;