From: Nicholas Clark Date: Wed, 8 Jun 2005 22:43:58 +0000 (+0000) Subject: Add SvPV_mutable for use by the old COW code. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=44d223002dcef65c7a5da4557c2a3682159e12ab;p=p5sagit%2Fp5-mst-13.2.git Add SvPV_mutable for use by the old COW code. p4raw-id: //depot/perl@24767 --- diff --git a/sv.h b/sv.h index 13ac3b1..a22fb8d 100644 --- a/sv.h +++ b/sv.h @@ -1199,6 +1199,7 @@ Like C 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 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)