This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
sort compare subs: don't do unnecessary scope work
authorDavid Mitchell <davem@iabyn.com>
Fri, 25 Dec 2015 22:28:14 +0000 (22:28 +0000)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 09:19:18 +0000 (09:19 +0000)
commit53d3542d62a6150413de482742e24f24b82112a8
tree3c46643591c734fd8dcbe53cbbd006280bf2ee02
parentd77cab044d85b109271a8fd3f99e99ac1392a029
sort compare subs: don't do unnecessary scope work

The 3 functions S_sortcv(), S_sortcv_stacked(), S_sortcv_xsub(),
which call a comparison function to compare $a and $b, do unnecessary work
with the scope and save stacks.

First, they pop any excess scope stack entries; but there shouldn't
be, since exiting the sort sub should have already pooped any inner
scopes. Indeed, running with an assert that PL_scopestack_ix == oldscopeix
didn't trigger any failures.

Secondly replace the unconditional leave_scope(oldsaveix) with
LEAVE_SCOPE(), which only calls the function if PL_savestack_ix >
oldsaveix.
pp_sort.c