summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-12-14 13:22:14 +0000
committerNicholas Clark <nick@ccl4.org>2005-12-14 13:22:14 +0000
commit7e25a7e974022d38c0b211f280644364acb3c3ee (patch)
tree2c565fbbc53d57cee3c1686d831016f07dabf7e9 /sv.c
parentcd8d64a74612bb62297f888bbc1cc2d41af073ef (diff)
downloadperl-7e25a7e974022d38c0b211f280644364acb3c3ee.tar.gz
The logic to use SVt_NV or SVt_PVNV is in sv_upgrade, so no need to
dupliate it in sv_2nv. Also, the final sv_upgrade is never called. p4raw-id: //depot/perl@26352
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/sv.c b/sv.c
index f89d624d97..30193b0424 100644
--- a/sv.c
+++ b/sv.c
@@ -2083,10 +2083,8 @@ Perl_sv_2nv(pTHX_ register SV *sv)
}
}
if (SvTYPE(sv) < SVt_NV) {
- if (SvTYPE(sv) == SVt_IV)
- sv_upgrade(sv, SVt_PVNV);
- else
- sv_upgrade(sv, SVt_NV);
+ /* The logic to use SVt_PVNV if necessary is in sv_upgrade. */
+ sv_upgrade(sv, SVt_NV);
#ifdef USE_LONG_DOUBLE
DEBUG_c({
STORE_NUMERIC_LOCAL_SET_STANDARD();
@@ -2207,11 +2205,10 @@ Perl_sv_2nv(pTHX_ register SV *sv)
else {
if (!PL_localizing && !(SvFLAGS(sv) & SVs_PADTMP) && ckWARN(WARN_UNINITIALIZED))
report_uninit(sv);
- if (SvTYPE(sv) < SVt_NV)
- /* Typically the caller expects that sv_any is not NULL now. */
- /* XXX Ilya implies that this is a bug in callers that assume this
- and ideally should be fixed. */
- sv_upgrade(sv, SVt_NV);
+ assert (SvTYPE(sv) >= SVt_NV);
+ /* Typically the caller expects that sv_any is not NULL now. */
+ /* XXX Ilya implies that this is a bug in callers that assume this
+ and ideally should be fixed. */
return 0.0;
}
#if defined(USE_LONG_DOUBLE)