Simplification in Perl_magic_clearsig, plus a fix similar and
Rafael Garcia-Suarez [Tue, 8 Aug 2006 09:22:27 +0000 (09:22 +0000)]
symmetrical to the one implemented in change #28669.
p4raw-link: @28669 on //depot/perl: 9289f461126f104eef437e7c6d2f1f640f935646

p4raw-id: //depot/perl@28675

mg.c

diff --git a/mg.c b/mg.c
index d4412f8..2e3bf46 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -1224,14 +1224,12 @@ Perl_magic_clearsig(pTHX_ SV *sv, MAGIC *mg)
        SV** svp = NULL;
        if (strEQ(s,"__DIE__"))
            svp = &PL_diehook;
-       else if (strEQ(s,"__WARN__"))
+       else if (strEQ(s,"__WARN__") && PL_warnhook != PERL_WARNHOOK_FATAL)
            svp = &PL_warnhook;
-       else
-           Perl_croak(aTHX_ "No such hook: %s", s);
        if (svp && *svp) {
-            SV * const to_dec = *svp;
+           SV *const to_dec = *svp;
            *svp = NULL;
-           SvREFCNT_dec(to_dec);
+           SvREFCNT_dec(to_dec);
        }
     }
     else {