This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
remove duplicate code and an extra branch in sv_setsv() and
[perl5.git] / scope.c
diff --git a/scope.c b/scope.c
index 4a2a778..4d62ae8 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -742,12 +742,8 @@ leave_scope(I32 base)
            sv = *(SV**)ptr;
            /* Can clear pad variable in place? */
            if (SvREFCNT(sv) <= 1 && !SvOBJECT(sv)) {
            sv = *(SV**)ptr;
            /* Can clear pad variable in place? */
            if (SvREFCNT(sv) <= 1 && !SvOBJECT(sv)) {
-               if (SvTHINKFIRST(sv)) {
-                   if (SvREADONLY(sv))
-                       croak("panic: leave_scope clearsv");
-                   if (SvROK(sv))
-                       sv_unref(sv);
-               }
+               if (SvTHINKFIRST(sv))
+                   sv_force_normal(sv);
                if (SvMAGICAL(sv))
                    mg_free(sv);
 
                if (SvMAGICAL(sv))
                    mg_free(sv);