summaryrefslogtreecommitdiff
path: root/gv.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-03-05 11:53:55 +0000
committerNicholas Clark <nick@ccl4.org>2006-03-05 11:53:55 +0000
commitf5c1e8072077f841044d944ef64ecf3a45cff725 (patch)
tree25d51fe0be0774c7e2db4cdebac16e094bb09487 /gv.h
parent49a7a762557426d9605bb476108c1375454ae233 (diff)
downloadperl-f5c1e8072077f841044d944ef64ecf3a45cff725.tar.gz
Provide Perl_gv_name_set to replace LVALUE use of GvNAME and GvNAMESET.
p4raw-id: //depot/perl@27377
Diffstat (limited to 'gv.h')
-rw-r--r--gv.h31
1 files changed, 17 insertions, 14 deletions
diff --git a/gv.h b/gv.h
index 22916dff05..de8ec52dd8 100644
--- a/gv.h
+++ b/gv.h
@@ -43,26 +43,29 @@ struct gp {
assert(SvTYPE(_gv) == SVt_PVGV || SvTYPE(_gv) >= SVt_PVLV); \
&(GvXPVGV(_gv)->xnv_u.xgv_stash); \
}))
-# define GvNAME(gv) \
- (*({ GV * const zzzz = (GV *) (gv); \
- assert(isGV_with_GP(zzzz)); \
- assert(SvTYPE(zzzz) == SVt_PVGV || SvTYPE(zzzz) >= SVt_PVLV); \
- &(GvXPVGV(zzzz)->xgv_name); \
- }))
-# define GvNAMELEN(gv) \
- (*({ GV * const glank = (GV *) (gv); \
- assert(isGV_with_GP(glank)); \
- assert(SvTYPE(glank) == SVt_PVGV || SvTYPE(glank) >= SVt_PVLV); \
- &(GvXPVGV(glank)->xgv_namelen); \
- }))
+# define GvNAME_get(gv) \
+ ({ GV * const zzzz = (GV *) (gv); \
+ assert(isGV_with_GP(zzzz)); \
+ assert(SvTYPE(zzzz) == SVt_PVGV || SvTYPE(zzzz) >= SVt_PVLV); \
+ 0 + (GvXPVGV(zzzz)->xgv_name); \
+ })
+# define GvNAMELEN_get(gv) \
+ ({ GV * const glank = (GV *) (gv); \
+ assert(isGV_with_GP(glank)); \
+ assert(SvTYPE(glank) == SVt_PVGV || SvTYPE(glank) >= SVt_PVLV); \
+ 0 + (GvXPVGV(glank)->xgv_namelen); \
+ })
#else
# define GvGP(gv) ((gv)->sv_u.svu_gp)
# define GvFLAGS(gv) (GvXPVGV(gv)->xpv_cur)
# define GvSTASH(gv) (GvXPVGV(gv)->xnv_u.xgv_stash)
-# define GvNAME(gv) (GvXPVGV(gv)->xgv_name)
-# define GvNAMELEN(gv) (GvXPVGV(gv)->xgv_namelen)
+# define GvNAME_get(gv) (0 + GvXPVGV(gv)->xgv_name)
+# define GvNAMELEN_get(gv) (0 + GvXPVGV(gv)->xgv_namelen)
#endif
+#define GvNAME(gv) GvNAME_get(gv)
+#define GvNAMELEN(gv) GvNAMELEN_get(gv)
+
#define GvASSIGN_GENERATION(gv) (0 + ((XPV*) SvANY(gv))->xpv_len)
#define GvASSIGN_GENERATION_set(gv,val) \
STMT_START { assert(SvTYPE(gv) == SVt_PVGV); \