/* pp_sort.c
*
* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- * 2000, 2001, 2002, 2003, 2004, 2005, 2006, by Larry Wall and others
+ * 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by Larry Wall and others
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
S_qsortsvu(pTHX_ SV ** array, size_t num_elts, SVCOMPARE_t compare)
{
register SV * temp;
-
struct partition_stack_entry partition_stack[QSORT_MAX_STACK];
int next_stack_entry = 0;
-
int part_left;
int part_right;
#ifdef QSORT_ORDER_GUESS
int swapped;
#endif
+ PERL_ARGS_ASSERT_QSORTSVU;
+
/* Make sure we actually have work to do.
*/
if (num_elts <= 1) {
void
Perl_sortsv(pTHX_ SV **array, size_t nmemb, SVCOMPARE_t cmp)
{
+ PERL_ARGS_ASSERT_SORTSV;
+
sortsv_flags(array, nmemb, cmp, 0);
}
void
Perl_sortsv_flags(pTHX_ SV **array, size_t nmemb, SVCOMPARE_t cmp, U32 flags)
{
+ PERL_ARGS_ASSERT_SORTSV_FLAGS;
+
if (flags & SORTf_QSORT)
S_qsortsv(aTHX_ array, nmemb, cmp, flags);
else
SV *tmpstr = sv_newmortal();
gv_efullname3(tmpstr, gv, NULL);
DIE(aTHX_ "Undefined sort subroutine \"%"SVf"\" called",
- (void*)tmpstr);
+ SVfARG(tmpstr));
}
else {
DIE(aTHX_ "Undefined subroutine in sort");
const I32 oldsaveix = PL_savestack_ix;
const I32 oldscopeix = PL_scopestack_ix;
I32 result;
+
+ PERL_ARGS_ASSERT_SORTCV;
+
GvSV(PL_firstgv) = a;
GvSV(PL_secondgv) = b;
PL_stack_sp = PL_stack_base;
I32 result;
AV * const av = GvAV(PL_defgv);
+ PERL_ARGS_ASSERT_SORTCV_STACKED;
+
if (AvMAX(av) < 1) {
SV** ary = AvALLOC(av);
if (AvARRAY(av) != ary) {
CV * const cv=(CV*)PL_sortcop;
I32 result;
+ PERL_ARGS_ASSERT_SORTCV_XSUB;
+
SP = PL_stack_base;
PUSHMARK(SP);
EXTEND(SP, 2);
{
const NV nv1 = SvNSIV(a);
const NV nv2 = SvNSIV(b);
+
+ PERL_ARGS_ASSERT_SV_NCMP;
+
return nv1 < nv2 ? -1 : nv1 > nv2 ? 1 : 0;
}
{
const IV iv1 = SvIV(a);
const IV iv2 = SvIV(b);
+
+ PERL_ARGS_ASSERT_SV_I_NCMP;
+
return iv1 < iv2 ? -1 : iv1 > iv2 ? 1 : 0;
}
{
dVAR;
SV * const tmpsv = tryCALL_AMAGICbin(a,b,ncmp);
+
+ PERL_ARGS_ASSERT_AMAGIC_NCMP;
+
if (tmpsv) {
if (SvIOK(tmpsv)) {
const I32 i = SvIVX(tmpsv);
{
dVAR;
SV * const tmpsv = tryCALL_AMAGICbin(a,b,ncmp);
+
+ PERL_ARGS_ASSERT_AMAGIC_I_NCMP;
+
if (tmpsv) {
if (SvIOK(tmpsv)) {
const I32 i = SvIVX(tmpsv);
{
dVAR;
SV * const tmpsv = tryCALL_AMAGICbin(str1,str2,scmp);
+
+ PERL_ARGS_ASSERT_AMAGIC_CMP;
+
if (tmpsv) {
if (SvIOK(tmpsv)) {
const I32 i = SvIVX(tmpsv);
{
dVAR;
SV * const tmpsv = tryCALL_AMAGICbin(str1,str2,scmp);
+
+ PERL_ARGS_ASSERT_AMAGIC_CMP_LOCALE;
+
if (tmpsv) {
if (SvIOK(tmpsv)) {
const I32 i = SvIVX(tmpsv);