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.
[perl5.git] / 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