This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Assimilate Digest 1.05
[perl5.git] / pp_sort.c
index d2d4bde..8fe6bcd 100644 (file)
--- a/pp_sort.c
+++ b/pp_sort.c
@@ -1,6 +1,7 @@
 /*    pp_sort.c
  *
- *    Copyright (c) 1991-2002, Larry Wall
+ *    Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+ *    2000, 2001, 2002, 2003, 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.
@@ -1455,8 +1456,8 @@ PP(pp_sort)
                else if (gv) {
                    SV *tmpstr = sv_newmortal();
                    gv_efullname3(tmpstr, gv, Nullch);
-                   DIE(aTHX_ "Undefined sort subroutine \"%s\" called",
-                       SvPVX(tmpstr));
+                   DIE(aTHX_ "Undefined sort subroutine \"%"SVf"\" called",
+                       tmpstr);
                }
                else {
                    DIE(aTHX_ "Undefined subroutine in sort");
@@ -1470,8 +1471,7 @@ PP(pp_sort)
                SAVEVPTR(CvROOT(cv)->op_ppaddr);
                CvROOT(cv)->op_ppaddr = PL_ppaddr[OP_NULL];
 
-               SAVEVPTR(PL_curpad);
-               PL_curpad = AvARRAY((AV*)AvARRAY(CvPADLIST(cv))[1]);
+               PAD_SET_CUR(CvPADLIST(cv), 1);
             }
        }
     }
@@ -1515,10 +1515,6 @@ PP(pp_sort)
                    PL_secondgv = gv_fetchpv("b", TRUE, SVt_PV);
                    PL_sortstash = stash;
                }
-#ifdef USE_5005THREADS
-               sv_lock((SV *)PL_firstgv);
-               sv_lock((SV *)PL_secondgv);
-#endif
                SAVESPTR(GvSV(PL_firstgv));
                SAVESPTR(GvSV(PL_secondgv));
            }
@@ -1535,13 +1531,11 @@ PP(pp_sort)
 
            if (hasargs && !is_xsub) {
                /* This is mostly copied from pp_entersub */
-               AV *av = (AV*)PL_curpad[0];
+               AV *av = (AV*)PAD_SVl(0);
 
-#ifndef USE_5005THREADS
                cx->blk_sub.savearray = GvAV(PL_defgv);
                GvAV(PL_defgv) = (AV*)SvREFCNT_inc(av);
-#endif /* USE_5005THREADS */
-               cx->blk_sub.oldcurpad = PL_curpad;
+               CX_CURPAD_SAVE(cx->blk_sub);
                cx->blk_sub.argarray = av;
            }
            sortsv((myorigmark+1), max,
@@ -1613,11 +1607,7 @@ sortcv_stacked(pTHX_ SV *a, SV *b)
     I32 result;
     AV *av;
 
-#ifdef USE_5005THREADS
-    av = (AV*)PL_curpad[0];
-#else
     av = GvAV(PL_defgv);
-#endif
 
     if (AvMAX(av) < 1) {
        SV** ary = AvALLOC(av);