This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
A little bit more safe version of HvMROMETA
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Fri, 20 Apr 2007 13:54:26 +0000 (13:54 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Fri, 20 Apr 2007 13:54:26 +0000 (13:54 +0000)
p4raw-id: //depot/perl@30994

hv.h

diff --git a/hv.h b/hv.h
index 7fb9fc4..a5ea429 100644 (file)
--- a/hv.h
+++ b/hv.h
@@ -266,7 +266,9 @@ C<SV*>.
 #define HvRITER_get(hv)        (SvOOK(hv) ? HvAUX(hv)->xhv_riter : -1)
 #define HvEITER_get(hv)        (SvOOK(hv) ? HvAUX(hv)->xhv_eiter : 0)
 #define HvNAME(hv)     HvNAME_get(hv)
-#define HvMROMETA(hv)  (HvAUX(hv)->xhv_mro_meta ? HvAUX(hv)->xhv_mro_meta : mro_meta_init(hv))
+#define HvMROMETA(hv)  (SvOOK(hv) \
+                       ? (HvAUX(hv)->xhv_mro_meta ? HvAUX(hv)->xhv_mro_meta : mro_meta_init(hv)) \
+                       : NULL)
 /* FIXME - all of these should use a UTF8 aware API, which should also involve
    getting the length. */
 /* This macro may go away without notice.  */