This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
No need to manually set the reference count of a new IO to 1.
authorNicholas Clark <nick@ccl4.org>
Thu, 25 Aug 2005 13:15:17 +0000 (13:15 +0000)
committerNicholas Clark <nick@ccl4.org>
Thu, 25 Aug 2005 13:15:17 +0000 (13:15 +0000)
p4raw-id: //depot/perl@25329

gv.c

diff --git a/gv.c b/gv.c
index 2726840..77ca69f 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -1222,7 +1222,10 @@ Perl_newIO(pTHX)
     IO * const io = (IO*)NEWSV(0,0);
 
     sv_upgrade((SV *)io,SVt_PVIO);
-    SvREFCNT(io) = 1;
+    /* This used to read SvREFCNT(io) = 1;
+       It's not clear why the reference count needed an explicit reset. NWC
+    */
+    assert (SvREFCNT(io) == 1);
     SvOBJECT_on(io);
     /* Clear the stashcache because a new IO could overrule a package name */
     hv_clear(PL_stashcache);