summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorBrian Ingerson <ingy@ttul.org>2001-09-29 10:41:13 -0700
committerJarkko Hietaniemi <jhi@iki.fi>2001-09-30 00:15:38 +0000
commit8d344e3e57673a7c678a1daf0c8a5f11c220a8f9 (patch)
treed686fa618e8493c8932fab2f95aa604436ad55f5 /pp_ctl.c
parent9ae8cd5b44680cc8af3d7ecc507f22e5e2031731 (diff)
downloadperl-8d344e3e57673a7c678a1daf0c8a5f11c220a8f9.tar.gz
Patch to put qsortsv in the public API
Message-ID: <20010929174113.A30223@ttul.org> p4raw-id: //depot/perl@12276
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 8b320bf92a..54587e9f95 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1018,8 +1018,8 @@ PP(pp_sort)
cx->blk_sub.oldcurpad = PL_curpad;
cx->blk_sub.argarray = av;
}
- qsortsv((myorigmark+1), max,
- is_xsub ? sortcv_xsub : hasargs ? sortcv_stacked : sortcv);
+ sortsv((myorigmark+1), max,
+ is_xsub ? sortcv_xsub : hasargs ? sortcv_stacked : sortcv);
POPBLOCK(cx,PL_curpm);
PL_stack_sp = newsp;
@@ -1030,8 +1030,8 @@ PP(pp_sort)
else {
if (max > 1) {
MEXTEND(SP, 20); /* Can't afford stack realloc on signal. */
- qsortsv(ORIGMARK+1, max,
- (PL_op->op_private & OPpSORT_NUMERIC)
+ sortsv(ORIGMARK+1, max,
+ (PL_op->op_private & OPpSORT_NUMERIC)
? ( (PL_op->op_private & OPpSORT_INTEGER)
? ( overloading ? amagic_i_ncmp : sv_i_ncmp)
: ( overloading ? amagic_ncmp : sv_ncmp))
@@ -4036,8 +4036,18 @@ dynprep(pTHX_ gptr *list1, gptr *list2, size_t nmemb, SVCOMPARE_t cmp)
** They make convenient temporary pointers in other places.
*/
-STATIC void
-S_qsortsv(pTHX_ gptr *list1, size_t nmemb, SVCOMPARE_t cmp)
+/*
+=for apidoc sortsv
+
+Sort an array in place. Here is an example:
+
+ sortsv(AvARRAY(av), av_len(av)+1, Perl_sv_cmp_locale);
+
+=cut
+*/
+
+void
+Perl_sortsv(pTHX_ gptr *list1, size_t nmemb, SVCOMPARE_t cmp)
{
int i, run;
int sense;