Merge the implementation of B::CV::{XSUB,XSUBANY} using ALIAS.
authorNicholas Clark <nick@ccl4.org>
Sun, 31 Oct 2010 08:16:54 +0000 (08:16 +0000)
committerNicholas Clark <nick@ccl4.org>
Sun, 31 Oct 2010 08:16:54 +0000 (08:16 +0000)
ext/B/B.xs

index 96d9dc50125c46e993034b9def0e1fef1eeb5bfa..4ecf1d9a0c98f622f5753b1cba657ddb5466d888 100644 (file)
@@ -1960,17 +1960,15 @@ CvSTART(cv)
 void
 CvXSUB(cv)
        B::CV   cv
+    ALIAS:
+       XSUBANY = 1
     CODE:
-       ST(0) = sv_2mortal(newSViv(CvISXSUB(cv) ? PTR2IV(CvXSUB(cv)) : 0));
-
-
-void
-CvXSUBANY(cv)
-       B::CV   cv
-    CODE:
-       ST(0) = CvCONST(cv)
+       ST(0) = ix && CvCONST(cv)
            ? make_sv_object(aTHX_ NULL, (SV *)CvXSUBANY(cv).any_ptr)
-           : sv_2mortal(newSViv(CvISXSUB(cv) ? CvXSUBANY(cv).any_iv : 0));
+           : sv_2mortal(newSViv(CvISXSUB(cv)
+                                ? (ix ? CvXSUBANY(cv).any_iv
+                                      : PTR2IV(CvXSUB(cv)))
+                                : 0));
 
 MODULE = B     PACKAGE = B::CV         PREFIX = cv_
 
@@ -1978,7 +1976,6 @@ B::SV
 cv_const_sv(cv)
        B::CV   cv
 
-
 MODULE = B     PACKAGE = B::HV         PREFIX = Hv
 
 STRLEN