summaryrefslogtreecommitdiff
path: root/pp_sort.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2017-08-06 11:38:28 -0700
committerFather Chrysostomos <sprout@cpan.org>2017-08-21 20:17:58 -0700
commitafe59f35c2b4b2af5b2ebc50a90e2e559b1eaf87 (patch)
treebb0e04d2ccf3f7eb1f6ebd79a14838b15441d57c /pp_sort.c
parent9f9332db9d7efbba5be5556810f700da32ad6dee (diff)
downloadperl-afe59f35c2b4b2af5b2ebc50a90e2e559b1eaf87.tar.gz
Add SORTf_UNSTABLE flag
This will allow a future commit to make mergesort unstable when the user specifies ‘no sort stable’, since it has been decided that mergesort should remain stable by default. This bit is not yet used, but is quite harmless.
Diffstat (limited to 'pp_sort.c')
-rw-r--r--pp_sort.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/pp_sort.c b/pp_sort.c
index a54768a022..ee1dc5dd98 100644
--- a/pp_sort.c
+++ b/pp_sort.c
@@ -46,6 +46,7 @@
#define SORTf_DESC 1
#define SORTf_STABLE 2
#define SORTf_QSORT 4
+#define SORTf_UNSTABLE 8
/*
* The mergesort implementation is by Peter M. Mcilroy <pmcilroy@lucent.com>.
@@ -1494,6 +1495,8 @@ PP(pp_sort)
sort_flags |= SORTf_QSORT;
if ((priv & OPpSORT_STABLE) != 0)
sort_flags |= SORTf_STABLE;
+ if ((priv & OPpSORT_UNSTABLE) != 0)
+ sort_flags |= SORTf_UNSTABLE;
if (gimme != G_ARRAY) {
SP = MARK;