This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Promote the warning about reference miscount in sv_replace to a panic.
authorNicholas Clark <nick@ccl4.org>
Thu, 25 Aug 2005 13:46:31 +0000 (13:46 +0000)
committerNicholas Clark <nick@ccl4.org>
Thu, 25 Aug 2005 13:46:31 +0000 (13:46 +0000)
TODO - document the panics

p4raw-id: //depot/perl@25330

sv.c

diff --git a/sv.c b/sv.c
index 88c864b..5089825 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -5408,8 +5408,10 @@ Perl_sv_replace(pTHX_ register SV *sv, register SV *nsv)
 {
     const U32 refcnt = SvREFCNT(sv);
     SV_CHECK_THINKFIRST_COW_DROP(sv);
-    if (SvREFCNT(nsv) != 1 && ckWARN_d(WARN_INTERNAL))
-       Perl_warner(aTHX_ packWARN(WARN_INTERNAL), "Reference miscount in sv_replace()");
+    if (SvREFCNT(nsv) != 1) {
+       Perl_croak(aTHX_ "panic: feference miscount on nsv in sv_replace() (%"
+                  UVuf " != 1)", (UV) SvREFCNT(nsv));
+    }
     if (SvMAGICAL(sv)) {
        if (SvMAGICAL(nsv))
            mg_free(nsv);