summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorGisle Aas <gisle@aas.no>1998-07-08 01:08:59 +0200
committerGurusamy Sarathy <gsar@cpan.org>1998-07-08 07:41:06 +0000
commitaece5585ce03c55b3c5a73afd84e1b977acd5360 (patch)
tree61c8df469c106a95c1c0a774f5e635f0b7437405 /sv.c
parentcb9505ffa7a98874f2965c3f21c94bb493c526b7 (diff)
downloadperl-aece5585ce03c55b3c5a73afd84e1b977acd5360.tar.gz
Faster copying from SvIV/SvNVs in sv_setsv()
Message-ID: <m3vhp9z7v8.fsf@furu.g.aas.no> p4raw-id: //depot/perl@1374
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c42
1 files changed, 33 insertions, 9 deletions
diff --git a/sv.c b/sv.c
index 2c9afc726e..60972b4d28 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);