This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
save RE context when calling __WARN__ and __DIE__ hooks;
authorGurusamy Sarathy <gsar@cpan.org>
Wed, 22 Mar 2000 15:38:49 +0000 (15:38 +0000)
committerGurusamy Sarathy <gsar@cpan.org>
Wed, 22 Mar 2000 15:38:49 +0000 (15:38 +0000)
add missing stack-of-stacks logic for new code that came
in with lexical warnings (this fixes coredumps from
-Mdiagnostics when the warnings happens to come from within
the RE engine)

p4raw-id: //depot/perl@5877

util.c

diff --git a/util.c b/util.c
index bda2beb..059d9a4 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1515,6 +1515,7 @@ Perl_vdie(pTHX_ const char* pat, va_list *args)
            SV *msg;
 
            ENTER;
+           save_re_context();
            if (message) {
                msg = newSVpvn(message, msglen);
                SvREADONLY_on(msg);
@@ -1604,6 +1605,7 @@ Perl_vcroak(pTHX_ const char* pat, va_list *args)
            SV *msg;
 
            ENTER;
+           save_re_context();
            msg = newSVpvn(message, msglen);
            SvREADONLY_on(msg);
            SAVEFREESV(msg);
@@ -1697,6 +1699,7 @@ Perl_vwarn(pTHX_ const char* pat, va_list *args)
            SV *msg;
 
            ENTER;
+           save_re_context();
            msg = newSVpvn(message, msglen);
            SvREADONLY_on(msg);
            SAVEFREESV(msg);
@@ -1810,15 +1813,17 @@ Perl_vwarner(pTHX_ U32  err, const char* pat, va_list* args)
                 SV *msg;
  
                 ENTER;
+               save_re_context();
                 msg = newSVpvn(message, msglen);
                 SvREADONLY_on(msg);
                 SAVEFREESV(msg);
  
+               PUSHSTACKi(PERLSI_DIEHOOK);
                 PUSHMARK(sp);
                 XPUSHs(msg);
                 PUTBACK;
                 call_sv((SV*)cv, G_DISCARD);
+               POPSTACK;
                 LEAVE;
             }
         }
@@ -1843,21 +1848,23 @@ Perl_vwarner(pTHX_ U32  err, const char* pat, va_list* args)
             SAVESPTR(PL_warnhook);
             PL_warnhook = Nullsv;
             cv = sv_2cv(oldwarnhook, &stash, &gv, 0);
-                LEAVE;
+           LEAVE;
             if (cv && !CvDEPTH(cv) && (CvROOT(cv) || CvXSUB(cv))) {
                 dSP;
                 SV *msg;
  
                 ENTER;
+               save_re_context();
                 msg = newSVpvn(message, msglen);
                 SvREADONLY_on(msg);
                 SAVEFREESV(msg);
  
+               PUSHSTACKi(PERLSI_WARNHOOK);
                 PUSHMARK(sp);
                 XPUSHs(msg);
                 PUTBACK;
                 call_sv((SV*)cv, G_DISCARD);
+               POPSTACK;
                 LEAVE;
                 return;
             }