This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Merge the implementation of B::REGEXP::{REGEXP,precomp} using ALIAS.
authorNicholas Clark <nick@ccl4.org>
Sun, 7 Nov 2010 15:03:43 +0000 (15:03 +0000)
committerNicholas Clark <nick@ccl4.org>
Mon, 8 Nov 2010 07:55:09 +0000 (07:55 +0000)
ext/B/B.xs

index 813ad8f..fa72c9e 100644 (file)
@@ -1582,20 +1582,19 @@ SvRV(sv)
 
 MODULE = B     PACKAGE = B::REGEXP
 
-IV
-REGEX(sv)
-       B::REGEXP       sv
-    CODE:
-       /* FIXME - can we code this method more efficiently?  */
-       RETVAL = PTR2IV(sv);
-    OUTPUT:
-        RETVAL
-
 void
-precomp(sv)
+REGEX(sv)
        B::REGEXP       sv
+    ALIAS:
+       precomp = 1
     PPCODE:
-       PUSHs(newSVpvn_flags(RX_PRECOMP(sv), RX_PRELEN(sv), SVs_TEMP));
+       if (ix) {
+           PUSHs(newSVpvn_flags(RX_PRECOMP(sv), RX_PRELEN(sv), SVs_TEMP));
+       } else {
+           dXSTARG;
+           /* FIXME - can we code this method more efficiently?  */
+           PUSHi(PTR2IV(sv));
+       }
 
 #endif