summaryrefslogtreecommitdiff
path: root/gv.h
diff options
context:
space:
mode:
authorMarcus Holland-Moritz <mhx-perl@gmx.net>2006-04-23 06:47:04 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-04-24 08:01:32 +0000
commit9f616d01cdd2df6cb0ab278ef65f90a68ac10150 (patch)
treebe1f5fb27c2e50c89bcc807f082c9021d6aeffd6 /gv.h
parentc395bd6cbc645e80f929b5b4e285b43aa4366851 (diff)
downloadperl-9f616d01cdd2df6cb0ab278ef65f90a68ac10150.tar.gz
Ensure GvNAME doesn't return NULL
First patch from : Subject: Re: [PATCH] cleanup 212 warnings emitted by gcc-4.2 Message-ID: <20060423044704.6a383ee8@r2d2> p4raw-id: //depot/perl@27944
Diffstat (limited to 'gv.h')
-rw-r--r--gv.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/gv.h b/gv.h
index ab745522e0..40139128b7 100644
--- a/gv.h
+++ b/gv.h
@@ -48,16 +48,17 @@ struct gp {
assert(SvTYPE(zzzz) == SVt_PVGV || SvTYPE(zzzz) >= SVt_PVLV); \
&(GvXPVGV(zzzz)->xiv_u.xivu_namehek); \
}))
+# define GvNAME_get(gv) ({ assert(GvNAME_HEK(gv)); HEK_KEY(GvNAME_HEK(gv)); })
+# define GvNAMELEN_get(gv) ({ assert(GvNAME_HEK(gv)); HEK_LEN(GvNAME_HEK(gv)); })
#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_HEK(gv) (GvXPVGV(gv)->xiv_u.xivu_namehek)
+# define GvNAME_get(gv) HEK_KEY(GvNAME_HEK(gv))
+# define GvNAMELEN_get(gv) HEK_LEN(GvNAME_HEK(gv))
#endif
-#define GvNAME_get(gv) (GvNAME_HEK(gv) ? HEK_KEY(GvNAME_HEK(gv)) : NULL)
-#define GvNAMELEN_get(gv) (GvNAME_HEK(gv) ? HEK_LEN(GvNAME_HEK(gv)) : 0)
-
#define GvNAME(gv) GvNAME_get(gv)
#define GvNAMELEN(gv) GvNAMELEN_get(gv)