summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorYitzchak Scott-Thoennes <sthoenna@efn.org>2002-09-04 14:09:01 -0700
committerhv <hv@crypt.org>2002-09-08 14:55:31 +0000
commit446eaa427e017001f2d47e21b0ad20ce965cd808 (patch)
tree166db7147f95e45ee8ab9812c7dc842373b673ec /sv.c
parenteb25aaf601be63900e7fddecbca6277c850b9e70 (diff)
downloadperl-446eaa427e017001f2d47e21b0ad20ce965cd808.tar.gz
sv_2pv_flags and ROK and UTF8 flags
Date: Wed, 04 Sep 2002 21:09:01 -0700 Message-ID: <djtd9gzkgyLd092yn@efn.org> Date: Fri, 06 Sep 2002 09:23:03 -0700 Message-ID: <nZNe9gzkgKdH092yn@efn.org> p4raw-id: //depot/perl@17864
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c42
1 files changed, 18 insertions, 24 deletions
diff --git a/sv.c b/sv.c
index 824cc8e0e7..6db4455d58 100644
--- a/sv.c
+++ b/sv.c
@@ -2935,8 +2935,14 @@ Perl_sv_2pv_flags(pTHX_ register SV *sv, STRLEN *lp, I32 flags)
if (SvROK(sv)) {
SV* tmpstr;
if (SvAMAGIC(sv) && (tmpstr=AMG_CALLun(sv,string)) &&
- (SvTYPE(tmpstr) != SVt_RV || (SvRV(tmpstr) != SvRV(sv))))
- return SvPV(tmpstr,*lp);
+ (SvTYPE(tmpstr) != SVt_RV || (SvRV(tmpstr) != SvRV(sv)))) {
+ char *pv = SvPV(tmpstr, *lp);
+ if (SvUTF8(tmpstr))
+ SvUTF8_on(sv);
+ else
+ SvUTF8_off(sv);
+ return pv;
+ }
sv = (SV*)SvRV(sv);
if (!sv)
s = "NULLREF";
@@ -3193,28 +3199,16 @@ would lose the UTF-8'ness of the PV.
void
Perl_sv_copypv(pTHX_ SV *dsv, register SV *ssv)
{
- SV *tmpsv;
-
- if ( SvTHINKFIRST(ssv) && SvROK(ssv) && SvAMAGIC(ssv) &&
- (tmpsv = AMG_CALLun(ssv,string))) {
- if (SvTYPE(tmpsv) != SVt_RV || (SvRV(tmpsv) != SvRV(ssv))) {
- SvSetSV(dsv,tmpsv);
- return;
- }
- } else {
- tmpsv = sv_newmortal();
- }
- {
- STRLEN len;
- char *s;
- s = SvPV(ssv,len);
- sv_setpvn(tmpsv,s,len);
- if (SvUTF8(ssv))
- SvUTF8_on(tmpsv);
- else
- SvUTF8_off(tmpsv);
- SvSetSV(dsv,tmpsv);
- }
+ SV *tmpsv = sv_newmortal();
+ STRLEN len;
+ char *s;
+ s = SvPV(ssv,len);
+ sv_setpvn(tmpsv,s,len);
+ if (SvUTF8(ssv))
+ SvUTF8_on(tmpsv);
+ else
+ SvUTF8_off(tmpsv);
+ SvSetSV(dsv,tmpsv);
}
/*