File::Spec compatibility update (from Barrie Slaymaker
[p5sagit/p5-mst-13.2.git] / pp_ctl.c
index 8c16af9..2308d35 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -883,15 +883,18 @@ PP(pp_sort)
 
            CATCH_SET(TRUE);
            PUSHSTACKi(PERLSI_SORT);
-           if (PL_sortstash != stash) {
-               PL_firstgv = gv_fetchpv("a", TRUE, SVt_PV);
-               PL_secondgv = gv_fetchpv("b", TRUE, SVt_PV);
-               PL_sortstash = stash;
+           if (!hasargs && !is_xsub) {
+               if (PL_sortstash != stash || !PL_firstgv || !PL_secondgv) {
+                   SAVESPTR(PL_firstgv);
+                   SAVESPTR(PL_secondgv);
+                   PL_firstgv = gv_fetchpv("a", TRUE, SVt_PV);
+                   PL_secondgv = gv_fetchpv("b", TRUE, SVt_PV);
+                   PL_sortstash = stash;
+               }
+               SAVESPTR(GvSV(PL_firstgv));
+               SAVESPTR(GvSV(PL_secondgv));
            }
 
-           SAVESPTR(GvSV(PL_firstgv));
-           SAVESPTR(GvSV(PL_secondgv));
-
            PUSHBLOCK(cx, CXt_NULL, PL_stack_base);
            if (!(PL_op->op_flags & OPf_SPECIAL)) {
                cx->cx_type = CXt_SUB;
@@ -2561,26 +2564,14 @@ S_docatch_body(pTHX)
     return NULL;
 }
 
-/* In Unicos 10.0.0.6 (T90) the cc seems to botch optimization so that
- * if cursi is an auto variable inside S_docatch() cursi doesn't get
- * properly saved/restored across longjmps. &/
-#ifdef UNICOS_BROKEN_VOLATILE
-volatile PERL_SI *cursi;
-#endif
-
 STATIC OP *
 S_docatch(pTHX_ OP *o)
 {
     dTHR;
     int ret;
     OP *oldop = PL_op;
-#ifdef UNICOS_BROKEN_VOLATILE
-    dJMPENV;
-    cursi = PL_curstackinfo;
-#else
     volatile PERL_SI *cursi = PL_curstackinfo;
     dJMPENV;
-#endif
 
 #ifdef DEBUGGING
     assert(CATCH_GET == TRUE);
@@ -2774,6 +2765,7 @@ S_doeval(pTHX_ int gimme, OP** startop)
     SAVESPTR(PL_beginav);
     PL_beginav = newAV();
     SAVEFREESV(PL_beginav);
+    SAVEI32(PL_error_count);
 
     /* try to compile it */