use libdbm.nfs.a if available (libdbm.a is missing dbmclose())
[p5sagit/p5-mst-13.2.git] / pp_hot.c
index 90e8f5f..2a398e1 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1914,6 +1914,7 @@ PP(pp_leavesub)
     PMOP *newpm;
     I32 gimme;
     register PERL_CONTEXT *cx;
+    SV *sv;
 
     POPBLOCK(cx,newpm);
  
@@ -1951,10 +1952,11 @@ PP(pp_leavesub)
     }
     PUTBACK;
     
-    POPSUB(cx);                /* Stack values are safe: release CV and @_ ... */
+    POPSUB(cx,sv);     /* Stack values are safe: release CV and @_ ... */
     PL_curpm = newpm;  /* ... and pop $1 et al */
 
     LEAVE;
+    LEAVESUB(sv);
     return pop_return();
 }
 
@@ -1968,6 +1970,7 @@ PP(pp_leavesublv)
     PMOP *newpm;
     I32 gimme;
     register PERL_CONTEXT *cx;
+    SV *sv;
 
     POPBLOCK(cx,newpm);
  
@@ -1995,7 +1998,7 @@ PP(pp_leavesublv)
                else {
                    /* Can be a localized value subject to deletion. */
                    PL_tmps_stack[++PL_tmps_ix] = *mark;
-                   SvREFCNT_inc(*mark);
+                   (void)SvREFCNT_inc(*mark);
                }
            }
        }
@@ -2005,8 +2008,10 @@ PP(pp_leavesublv)
         * the refcounts so the caller gets a live guy. Cannot set
         * TEMP, so sv_2mortal is out of question. */
        if (!CvLVALUE(cx->blk_sub.cv)) {
-           POPSUB(cx);
+           POPSUB(cx,sv);
            PL_curpm = newpm;
+           LEAVE;
+           LEAVESUB(sv);
            DIE(aTHX_ "Can't modify non-lvalue subroutine call");
        }
        if (gimme == G_SCALAR) {
@@ -2014,20 +2019,24 @@ PP(pp_leavesublv)
            EXTEND_MORTAL(1);
            if (MARK == SP) {
                if (SvFLAGS(TOPs) & (SVs_TEMP | SVs_PADTMP | SVf_READONLY)) {
-                   POPSUB(cx);
+                   POPSUB(cx,sv);
                    PL_curpm = newpm;
+                   LEAVE;
+                   LEAVESUB(sv);
                    DIE(aTHX_ "Can't return a %s from lvalue subroutine",
                        SvREADONLY(TOPs) ? "readonly value" : "temporary");
                }
                else {                  /* Can be a localized value
                                         * subject to deletion. */
                    PL_tmps_stack[++PL_tmps_ix] = *mark;
-                   SvREFCNT_inc(*mark);
+                   (void)SvREFCNT_inc(*mark);
                }
            }
            else {                      /* Should not happen? */
-               POPSUB(cx);
+               POPSUB(cx,sv);
                PL_curpm = newpm;
+               LEAVE;
+               LEAVESUB(sv);
                DIE(aTHX_ "%s returned from lvalue subroutine in scalar context",
                    (MARK > SP ? "Empty array" : "Array"));
            }
@@ -2039,8 +2048,10 @@ PP(pp_leavesublv)
                if (SvFLAGS(*mark) & (SVs_TEMP | SVs_PADTMP | SVf_READONLY)) {
                    /* Might be flattened array after $#array =  */
                    PUTBACK;
-                   POPSUB(cx);
+                   POPSUB(cx,sv);
                    PL_curpm = newpm;
+                   LEAVE;
+                   LEAVESUB(sv);
                    DIE(aTHX_ "Can't return %s from lvalue subroutine",
                        (*mark != &PL_sv_undef)
                        ? (SvREADONLY(TOPs)
@@ -2051,7 +2062,7 @@ PP(pp_leavesublv)
                    mortalize:
                    /* Can be a localized value subject to deletion. */
                    PL_tmps_stack[++PL_tmps_ix] = *mark;
-                   SvREFCNT_inc(*mark);
+                   (void)SvREFCNT_inc(*mark);
                }
            }
        }
@@ -2093,10 +2104,11 @@ PP(pp_leavesublv)
     }
     PUTBACK;
     
-    POPSUB(cx);                /* Stack values are safe: release CV and @_ ... */
+    POPSUB(cx,sv);     /* Stack values are safe: release CV and @_ ... */
     PL_curpm = newpm;  /* ... and pop $1 et al */
 
     LEAVE;
+    LEAVESUB(sv);
     return pop_return();
 }
 
@@ -2287,7 +2299,7 @@ try_autoload:
            DEBUG_S(PerlIO_printf(Perl_debug_log, "%p: pp_entersub lock %p\n",
                                  thr, sv);)
            MUTEX_UNLOCK(MgMUTEXP(mg));
-           SAVEDESTRUCTOR(Perl_unlock_condpair, sv);
+           SAVEDESTRUCTOR_X(Perl_unlock_condpair, sv);
        }
        MUTEX_LOCK(CvMUTEXP(cv));
     }
@@ -2332,7 +2344,7 @@ try_autoload:
            CvOWNER(cv) = thr;
            SvREFCNT_inc(cv);
            if (CvDEPTH(cv) == 0)
-               SAVEDESTRUCTOR(unset_cvowner, (void*) cv);
+               SAVEDESTRUCTOR_X(unset_cvowner, (void*) cv);
        }
        else {
            /* (2) => grab ownership of cv. (3) => make clone */
@@ -2370,7 +2382,7 @@ try_autoload:
            DEBUG_S(if (CvDEPTH(cv) != 0)
                        PerlIO_printf(Perl_debug_log, "depth %ld != 0\n",
                                      CvDEPTH(cv)););
-           SAVEDESTRUCTOR(unset_cvowner, (void*) cv);
+           SAVEDESTRUCTOR_X(unset_cvowner, (void*) cv);
        }
     }
 #endif /* USE_THREADS */