Fix newSVrv so sv_setref_foo work better:
Owen Taylor [Thu, 27 Nov 1997 00:25:50 +0000 (19:25 -0500)]
Subject: [PATCH] [5.004_55] newSVrv (again)

p4raw-id: //depot/perl@319

sv.c

diff --git a/sv.c b/sv.c
index 77feae2..649f623 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -3883,7 +3883,16 @@ newSVrv(SV *rv, char *classname)
     SvANY(sv) = 0;
     SvREFCNT(sv) = 0;
     SvFLAGS(sv) = 0;
-    sv_upgrade(rv, SVt_RV);
+
+    sv_check_thinkfirst(rv);
+#ifdef OVERLOAD
+    SvAMAGIC_off(rv);
+#endif /* OVERLOAD */
+
+    if (SvTYPE(rv) < SVt_RV)
+      sv_upgrade(rv, SVt_RV);
+
+    (void)SvOK_off(rv);
     SvRV(rv) = SvREFCNT_inc(sv);
     SvROK_on(rv);