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

sv.h

diff --git a/sv.h b/sv.h
index 377f9a3..9993312 100644 (file)
--- a/sv.h
+++ b/sv.h
@@ -1224,7 +1224,12 @@ Like C<sv_catsv> but doesn't process magic.
     ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
      ? SvPVX(sv) : sv_2pv_flags(sv, 0, SV_GMAGIC))
 
+#define SvPV_nolen_const(sv) \
+    ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
+     ? SvPVX_const(sv) : sv_2pv_flags(sv, 0, SV_GMAGIC|SV_CONST_RETURN))
+
 #define SvPV_nomg(sv, lp) SvPV_flags(sv, lp, 0)
+#define SvPV_nomg_const(sv, lp) SvPV_flags_const(sv, lp, 0)
 
 /* ----*/
 
@@ -1273,6 +1278,7 @@ Like C<sv_catsv> but doesn't process magic.
 #  define SvNVx(sv) ({SV *_sv = (SV*)(sv); SvNV(_sv); })
 #  define SvPVx(sv, lp) ({SV *_sv = (sv); SvPV(_sv, lp); })
 #  define SvPVx_const(sv, lp) ({SV *_sv = (sv); SvPV_const(_sv, lp); })
+#  define SvPVx_nolen_const(sv) ({SV *_sv = (sv); SvPV_nolen_const(_sv); })
 #  define SvPVutf8x(sv, lp) ({SV *_sv = (sv); SvPVutf8(_sv, lp); })
 #  define SvPVbytex(sv, lp) ({SV *_sv = (sv); SvPVbyte(_sv, lp); })
 #  define SvTRUE(sv) (                                         \