summaryrefslogtreecommitdiff
path: root/pp_sort.c
diff options
context:
space:
mode:
authorTomasz Konojacki <me@xenu.pl>2020-03-03 00:45:04 +0100
committerKarl Williamson <khw@cpan.org>2020-03-09 07:55:49 -0600
commit433b3e2b7846f8a9c2506397c0b4d1394bf7700d (patch)
treefbc0159248a77f95e7be6e06bf342a1eca01a8bb /pp_sort.c
parent3edfb5c3c50da87c76cb787628484b80e811c8e7 (diff)
downloadperl-433b3e2b7846f8a9c2506397c0b4d1394bf7700d.tar.gz
pp_sort.c: small refactoring
This will make the future changes a bit easier.
Diffstat (limited to 'pp_sort.c')
-rw-r--r--pp_sort.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/pp_sort.c b/pp_sort.c
index 339122d98e..789c843660 100644
--- a/pp_sort.c
+++ b/pp_sort.c
@@ -836,21 +836,34 @@ PP(pp_sort)
else {
MEXTEND(SP, 20); /* Can't afford stack realloc on signal. */
start = ORIGMARK+1;
- Perl_sortsv_flags(aTHX_ start, max,
- (priv & OPpSORT_NUMERIC)
- ? ( ( ( priv & OPpSORT_INTEGER) || all_SIVs)
- ? ( overloading ? S_amagic_i_ncmp : S_sv_i_ncmp)
- : ( overloading ? S_amagic_ncmp : S_sv_ncmp ) )
- : (
+ if (priv & OPpSORT_NUMERIC) {
+ if ((priv & OPpSORT_INTEGER) || all_SIVs) {
+ if (overloading)
+ Perl_sortsv_flags(aTHX_ start, max, S_amagic_i_ncmp, sort_flags);
+ else
+ Perl_sortsv_flags(aTHX_ start, max, S_sv_i_ncmp, sort_flags);
+ }
+ else {
+ if (overloading)
+ Perl_sortsv_flags(aTHX_ start, max, S_amagic_ncmp, sort_flags);
+ else
+ Perl_sortsv_flags(aTHX_ start, max, S_sv_ncmp, sort_flags);
+ }
+ }
#ifdef USE_LOCALE_COLLATE
- IN_LC_RUNTIME(LC_COLLATE)
- ? ( overloading
- ? (SVCOMPARE_t)S_amagic_cmp_locale
- : (SVCOMPARE_t)sv_cmp_locale_static)
- :
+ else if(IN_LC_RUNTIME(LC_COLLATE)) {
+ if (overloading)
+ Perl_sortsv_flags(aTHX_ start, max, S_amagic_cmp_locale, sort_flags);
+ else
+ Perl_sortsv_flags(aTHX_ start, max, sv_cmp_locale_static, sort_flags);
+ }
#endif
- ( overloading ? (SVCOMPARE_t)S_amagic_cmp : (SVCOMPARE_t)sv_cmp_static)),
- sort_flags);
+ else {
+ if (overloading)
+ Perl_sortsv_flags(aTHX_ start, max, S_amagic_cmp, sort_flags);
+ else
+ Perl_sortsv_flags(aTHX_ start, max, sv_cmp_static, sort_flags);
+ }
}
if ((priv & OPpSORT_REVERSE) != 0) {
SV **q = start+max-1;