summaryrefslogtreecommitdiff
path: root/pp_sort.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2015-10-15 11:16:14 +0100
committerDavid Mitchell <davem@iabyn.com>2016-02-03 08:59:42 +0000
commit796464187416d7ed9e48c8ce9a8dffeeba5b8240 (patch)
treee785c4f49d5ca6581ee0c679328a59ae82058f74 /pp_sort.c
parent72c5b62dfd0d91a02743d4b2fe0d8b8d04488753 (diff)
downloadperl-796464187416d7ed9e48c8ce9a8dffeeba5b8240.tar.gz
sort(!) out CXt_NULL and CXp_MULTICALL
A sort BLOCK is done using a CXt_NULL context type. Currently it has the CXp_MULTICALL flag set. Remove this flag so that CXp_MULTICALL is only set on CXt_SUB contexts. Also add code comments in various places explainging that CXt_NULL is likely to a sort BLOCK, and fix the comments in pp_return which said a particular code path was only taken by sort BLOCK; it's also taken be (?{...}) too.
Diffstat (limited to 'pp_sort.c')
-rw-r--r--pp_sort.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/pp_sort.c b/pp_sort.c
index 5cab1292da..706e2d6475 100644
--- a/pp_sort.c
+++ b/pp_sort.c
@@ -1670,7 +1670,7 @@ PP(pp_sort)
gimme = G_SCALAR;
PUSHBLOCK(cx, CXt_NULL, PL_stack_base);
if (!(flags & OPf_SPECIAL)) {
- cx->cx_type = CXt_SUB;
+ cx->cx_type = CXt_SUB|CXp_MULTICALL;
PUSHSUB(cx);
if (!is_xsub) {
PADLIST * const padlist = CvPADLIST(cv);
@@ -1692,15 +1692,12 @@ PP(pp_sort)
}
}
else {
- /* mimic PUSHSUB. Note that we're cheating and using a
- * CXt_NULL block as a CXt_SUB block */
+ /* /sort BLOCK: CXt_NULL */
cx->cx_u.cx_blk.blku_old_tmpsfloor = PL_tmps_floor;
PL_tmps_floor = PL_tmps_ix;
}
cx->cx_u.cx_blk.blku_old_savestack_ix = old_savestack_ix;
- cx->cx_type |= CXp_MULTICALL;
-
start = p1 - max;
sortsvp(aTHX_ start, max,
(is_xsub ? S_sortcv_xsub : hasargs ? S_sortcv_stacked : S_sortcv),