This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add MgPV_const
authorNicholas Clark <nick@ccl4.org>
Tue, 7 Jun 2005 18:32:44 +0000 (18:32 +0000)
committerNicholas Clark <nick@ccl4.org>
Tue, 7 Jun 2005 18:32:44 +0000 (18:32 +0000)
p4raw-id: //depot/perl@24738

mg.h

diff --git a/mg.h b/mg.h
index 76903ca..f07c248 100644 (file)
--- a/mg.h
+++ b/mg.h
@@ -48,6 +48,9 @@ struct magic {
 #define MgPV(mg,lp)            ((((int)(lp = (mg)->mg_len)) == HEf_SVKEY) ?   \
                                 SvPV((SV*)((mg)->mg_ptr),lp) :         \
                                 (mg)->mg_ptr)
 #define MgPV(mg,lp)            ((((int)(lp = (mg)->mg_len)) == HEf_SVKEY) ?   \
                                 SvPV((SV*)((mg)->mg_ptr),lp) :         \
                                 (mg)->mg_ptr)
+#define MgPV_const(mg,lp)      ((((int)(lp = (mg)->mg_len)) == HEf_SVKEY) ?   \
+                                SvPV_const((SV*)((mg)->mg_ptr),lp) :   \
+                                (const char*)(mg)->mg_ptr)
 
 #define SvTIED_mg(sv,how) \
     (SvRMAGICAL(sv) ? mg_find((sv),(how)) : Null(MAGIC*))
 
 #define SvTIED_mg(sv,how) \
     (SvRMAGICAL(sv) ? mg_find((sv),(how)) : Null(MAGIC*))