This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add SvPV_mutable for use by the old COW code.
authorNicholas Clark <nick@ccl4.org>
Wed, 8 Jun 2005 22:43:58 +0000 (22:43 +0000)
committerNicholas Clark <nick@ccl4.org>
Wed, 8 Jun 2005 22:43:58 +0000 (22:43 +0000)
p4raw-id: //depot/perl@24767

sv.h

diff --git a/sv.h b/sv.h
index 13ac3b1..a22fb8d 100644 (file)
--- a/sv.h
+++ b/sv.h
@@ -1199,6 +1199,7 @@ Like C<sv_catsv> but doesn't process magic.
 
 #define SvPV(sv, lp) SvPV_flags(sv, lp, SV_GMAGIC)
 #define SvPV_const(sv, lp) SvPV_flags_const(sv, lp, SV_GMAGIC)
+#define SvPV_mutable(sv, lp) SvPV_flags_mutable(sv, lp, SV_GMAGIC)
 
 #define SvPV_flags(sv, lp, flags) \
     ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
@@ -1207,6 +1208,10 @@ Like C<sv_catsv> but doesn't process magic.
     ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
      ? ((lp = SvCUR(sv)), SvPVX_const(sv)) : \
      (const char*) sv_2pv_flags(sv, &lp, flags|SV_CONST_RETURN))
+#define SvPV_flags_mutable(sv, lp, flags) \
+    ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
+     ? ((lp = SvCUR(sv)), SvPVX_mutable(sv)) : \
+     sv_2pv_flags(sv, &lp, flags|SV_MUTABLE_RETURN))
 
 #define SvPV_force(sv, lp) SvPV_force_flags(sv, lp, SV_GMAGIC)
 #define SvPV_force_nolen(sv) SvPV_force_flags_nolen(sv, SV_GMAGIC)