From: Gisle Aas Date: Tue, 7 Jul 1998 23:08:59 +0000 (+0200) Subject: Faster copying from SvIV/SvNVs in sv_setsv() X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=aece5585ce03c55b3c5a73afd84e1b977acd5360;p=p5sagit%2Fp5-mst-13.2.git Faster copying from SvIV/SvNVs in sv_setsv() Message-ID: p4raw-id: //depot/perl@1374 --- diff --git a/sv.c b/sv.c index 2c9afc7..60972b4 100644 --- a/sv.c +++ b/sv.c @@ -1928,29 +1928,53 @@ sv_setsv(SV *dstr, register SV *sstr) switch (stype) { case SVt_NULL: + undef_sstr: if (dtype != SVt_PVGV) { (void)SvOK_off(dstr); return; } break; case SVt_IV: - if (dtype != SVt_IV && dtype < SVt_PVIV) { - if (dtype < SVt_IV) + if (SvIOK(sstr)) { + switch (dtype) { + case SVt_NULL: sv_upgrade(dstr, SVt_IV); - else if (dtype == SVt_NV) + break; + case SVt_NV: sv_upgrade(dstr, SVt_PVNV); - else + break; + case SVt_RV: + case SVt_PV: sv_upgrade(dstr, SVt_PVIV); + break; + } + (void)SvIOK_only(dstr); + SvIVX(dstr) = SvIVX(sstr); + SvTAINT(dstr); + return; } - break; + goto undef_sstr; + case SVt_NV: - if (dtype != SVt_NV && dtype < SVt_PVNV) { - if (dtype < SVt_NV) + if (SvNOK(sstr)) { + switch (dtype) { + case SVt_NULL: + case SVt_IV: sv_upgrade(dstr, SVt_NV); - else + break; + case SVt_RV: + case SVt_PV: + case SVt_PVIV: sv_upgrade(dstr, SVt_PVNV); + break; + } + SvNVX(dstr) = SvNVX(sstr); + (void)SvNOK_only(dstr); + SvTAINT(dstr); + return; } - break; + goto undef_sstr; + case SVt_RV: if (dtype < SVt_RV) sv_upgrade(dstr, SVt_RV);