avoid race condition (storing ptr to SV before incrementing its
Gurusamy Sarathy [Sun, 5 Jul 1998 02:28:04 +0000 (02:28 +0000)]
REFCNT) and warning in newRV()

p4raw-id: //depot/perl@1314

sv.c

diff --git a/sv.c b/sv.c
index f60e820..6e137a3 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -3708,10 +3708,7 @@ newRV_noinc(SV *tmpRef)
 SV *
 newRV(SV *tmpRef)
 {
-    register SV *sv;
-    sv = newRV_noinc(tmpRef);
-    SvREFCNT_inc(tmpRef);
-    return sv;
+    return newRV_noinc(SvREFCNT_inc(tmpRef));
 }
 
 /* make an exact duplicate of old */