From 2fc49ef14c391f64250e0f99fbbed2007b880289 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Sat, 15 Oct 2011 14:05:33 -0700 Subject: 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. --- pp_sort.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'pp_sort.c') diff --git a/pp_sort.c b/pp_sort.c index 2257d2f8c9..d527d1e7e8 100644 --- a/pp_sort.c +++ b/pp_sort.c @@ -1525,11 +1525,11 @@ PP(pp_sort) hasargs = TRUE; } } - if (!(cv && CvROOT(cv))) { - if (cv && CvISXSUB(cv)) { - is_xsub = 1; - } - else if (gv) { + if (cv && CvISXSUB(cv) && CvXSUB(cv)) { + is_xsub = 1; + } + else if (!(cv && CvROOT(cv))) { + if (gv) { goto autoload; } else if (!CvANON(cv) && (gv = CvGV(cv))) { -- cgit v1.2.1