Change 33181 by [EMAIL PROTECTED] on 2008/02/02 00:16:02

        In XS_re_regexp_pattern(), use newSVpvn_flags() to avoid calls to
        sv_2mortal().

Affected files ...

... //depot/perl/universal.c#186 edit

Differences ...

==== //depot/perl/universal.c#186 (text) ====
Index: perl/universal.c
--- perl/universal.c#185~33103~ 2008-01-29 02:53:24.000000000 -0800
+++ perl/universal.c    2008-02-01 16:16:02.000000000 -0800
@@ -1238,13 +1238,12 @@
                 match_flags >>= 1;
             }
 
-            pattern = sv_2mortal(newSVpvn(RX_PRECOMP(re),RX_PRELEN(re)));
-            if (RX_UTF8(re))
-                SvUTF8_on(pattern);
+            pattern = newSVpvn_flags(RX_PRECOMP(re),RX_PRELEN(re),
+                                    (RX_UTF8(re) ? SVf_UTF8 : 0) | SVs_TEMP);
 
             /* return the pattern and the modifiers */
             XPUSHs(pattern);
-            XPUSHs(sv_2mortal(newSVpvn(reflags,left)));
+            XPUSHs(newSVpvn_flags(reflags, left, SVs_TEMP));
             XSRETURN(2);
         } else {
             /* Scalar, so use the string that Perl would return */
@@ -1252,9 +1251,8 @@
 #if PERL_VERSION >= 11
             pattern = sv_2mortal(newSVsv((SV*)re));
 #else
-            pattern = sv_2mortal(newSVpvn(RX_WRAPPED(re),RX_WRAPLEN(re)));
-            if (RX_UTF8(re))
-                SvUTF8_on(pattern);
+            pattern = newSVpvn_flags(RX_WRAPPED(re), RX_WRAPLEN(re),
+                                    (RX_UTF8(re) ? SVf_UTF8 : 0) | SVs_TEMP);
 #endif
             XPUSHs(pattern);
             XSRETURN(1);
End of Patch.

Reply via email to