This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In B::REGEX::precomp, use newSVpvn_flags() instead of newSVpvn().
authorNicholas Clark <nick@ccl4.org>
Sun, 7 Nov 2010 10:36:57 +0000 (10:36 +0000)
committerNicholas Clark <nick@ccl4.org>
Mon, 8 Nov 2010 07:55:09 +0000 (07:55 +0000)
Using newSVpvn_flags() and SVt_TEMP and an explicit push is one API call.
newSVpvn() and RETVAL results in a second API call, sv_2mortal(), in the return
typemap.

ext/B/B.xs

index 3e10f3c..813ad8f 100644 (file)
@@ -1591,13 +1591,11 @@ REGEX(sv)
     OUTPUT:
         RETVAL
 
-SV*
+void
 precomp(sv)
        B::REGEXP       sv
-    CODE:
-       RETVAL = newSVpvn( RX_PRECOMP(sv), RX_PRELEN(sv) );
-    OUTPUT:
-        RETVAL
+    PPCODE:
+       PUSHs(newSVpvn_flags(RX_PRECOMP(sv), RX_PRELEN(sv), SVs_TEMP));
 
 #endif