This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
DEFSV causes GvSVn() to be used in lvalue context.
authorNicholas Clark <nick@ccl4.org>
Fri, 8 Jul 2005 15:57:16 +0000 (15:57 +0000)
committerNicholas Clark <nick@ccl4.org>
Fri, 8 Jul 2005 15:57:16 +0000 (15:57 +0000)
Not sure if instead we should recode DEFSV to avoid this, and leave
GvSVn() as rvalue only, like its namesakes.

p4raw-id: //depot/perl@25099

gv.h

diff --git a/gv.h b/gv.h
index 9034e59..0c776ba 100644 (file)
--- a/gv.h
+++ b/gv.h
@@ -42,9 +42,9 @@ Return the SV from the GV.
 
 #define GvSV(gv)       (GvGP(gv)->gp_sv)
 #ifdef PERL_DONT_CREATE_GVSV
-#define GvSVn(gv)      (GvGP(gv)->gp_sv ? \
-                        GvGP(gv)->gp_sv : \
-                        GvGP(gv_SVadd(gv))->gp_sv)
+#define GvSVn(gv)      (*(GvGP(gv)->gp_sv ? \
+                        &(GvGP(gv)->gp_sv) : \
+                        &(GvGP(gv_SVadd(gv))->gp_sv)))
 #else
 #define GvSVn(gv)      GvSV(gv)
 #endif