summaryrefslogtreecommitdiff
path: root/ext/XS-APItest/APItest.xs
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-10-15 14:05:33 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-10-15 14:24:27 -0700
commit2fc49ef14c391f64250e0f99fbbed2007b880289 (patch)
tree09a7cf04ca5912c7f2c2dec482ff0d5638f8e51b /ext/XS-APItest/APItest.xs
parent67ecba2f90752611c774e73ef7ad292d8d4a03c9 (diff)
downloadperl-2fc49ef14c391f64250e0f99fbbed2007b880289.tar.gz
Make XS sort routines work again
These stopped working when the CvROOT and CvXSUB fields were merged in 5.10.0: $ perl5.8.9 -le 'print sort utf8::is_utf8 2,1' Usage: utf8::is_utf8(sv) at -e line 1. $ perl5.10.0 -le 'print sort utf8::is_utf8 2,1' 12 (In the latter case, the utf8::is_utf8 routine is not being called.) pp_sort has this: if (!(cv && CvROOT(cv))) { if (cv && CvISXSUB(cv)) { But CvROOT is the same as CvXSUB, so that block is never entered for XSUBs, so this piece of code later on: if (is_xsub) PL_sortcop = (OP*)cv; else PL_sortcop = CvSTART(cv); sets PL_sortcop to CvSTART for XSUBs, but CvSTART is NULL. Later on, this if condition fails: if (PL_sortcop) { so the XSUB is treated as being absent.
Diffstat (limited to 'ext/XS-APItest/APItest.xs')
-rw-r--r--ext/XS-APItest/APItest.xs11
1 files changed, 11 insertions, 0 deletions
diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs
index 1d8a5511a9..f5aa9bd038 100644
--- a/ext/XS-APItest/APItest.xs
+++ b/ext/XS-APItest/APItest.xs
@@ -3243,6 +3243,17 @@ CODE:
OUTPUT:
RETVAL
+int
+xs_cmp(int a, int b)
+CODE:
+ /* Odd sorting (odd numbers first), to make sure we are actually
+ being called */
+ RETVAL = a % 2 != b % 2
+ ? a % 2 ? -1 : 1
+ : a < b ? -1 : a == b ? 0 : 1;
+OUTPUT:
+ RETVAL
+
MODULE = XS::APItest PACKAGE = XS::APItest::AUTOLOADtest