{
PERL_ARGS_ASSERT_SV_2PVBYTE;
- if ((SvTHINKFIRST(sv) && !SvIsCOW(sv)) || isGV_with_GP(sv)) {
+ if (((SvREADONLY(sv) || SvFAKE(sv)) && !SvIsCOW(sv))
+ || isGV_with_GP(sv) || SvROK(sv)) {
SV *sv2 = sv_newmortal();
sv_copypv(sv2,sv);
sv = sv2;
{
PERL_ARGS_ASSERT_SV_2PVUTF8;
- if ((SvTHINKFIRST(sv) && !SvIsCOW(sv)) || isGV_with_GP(sv))
+ if (((SvREADONLY(sv) || SvFAKE(sv)) && !SvIsCOW(sv))
+ || isGV_with_GP(sv) || SvROK(sv))
sv = sv_mortalcopy(sv);
else
SvGETMAGIC(sv);
stype = SvTYPE(sstr);
dtype = SvTYPE(dstr);
- if ( SvVOK(dstr) )
- {
- /* need to nuke the magic */
- sv_unmagic(dstr, PERL_MAGIC_vstring);
- }
-
/* There's a lot of redundancy below but we're going for speed here */
switch (stype) {
/*
=for apidoc sv_force_normal_flags
-Undo various types of fakery on an SV: if the PV is a shared string, make
+Undo various types of fakery on an SV, where fakery means
+"more than" a string: if the PV is a shared string, make
a private copy; if we're a ref, stop refing; if we're a glob, downgrade to
an xpvmg; if we're a copy-on-write scalar, this is the on-write time when
-we do the copy, and is also used locally. If C<SV_COW_DROP_PV> is set
+we do the copy, and is also used locally; if this is a
+vstring, drop the vstring magic. If C<SV_COW_DROP_PV> is set
then a copy-on-write scalar drops its PV buffer (if any) and becomes
SvPOK_off rather than making a copy. (Used where this
scalar is about to be set to some other value.) In addition,
SvREFCNT_dec(temp);
}
+ else if (SvVOK(sv)) sv_unmagic(sv, PERL_MAGIC_vstring);
}
/*
PTR2UV(sv),SvPVX_const(sv)));
}
}
+ (void)SvPOK_only_UTF8(sv);
return SvPVX_mutable(sv);
}