diff options
author | Nicholas Clark <nick@ccl4.org> | 2005-11-18 11:20:10 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-11-18 11:20:10 +0000 |
commit | a95c302be5eb00c1f54619017ae777b107c54275 (patch) | |
tree | 4b938db74498831e8ad556d0392c623249b546c1 /sv.c | |
parent | 5d2608fa57ffadbf2606aff93cca48c890795e02 (diff) | |
download | perl-a95c302be5eb00c1f54619017ae777b107c54275.tar.gz |
Simplify the expression for the upgrade logic for SVt_IV.
Replace the "can't happen" comment for SVt_PVIV with assertions
that it didn't happen.
p4raw-id: //depot/perl@26158
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -1460,10 +1460,10 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 new_type) case SVt_NULL: break; case SVt_IV: - if (new_type == SVt_NV) - new_type = SVt_PVNV; - else if (new_type < SVt_PVIV) - new_type = SVt_PVIV; + if (new_type < SVt_PVIV) { + new_type = (new_type == SVt_NV) + ? SVt_PVNV : SVt_PVIV; + } break; case SVt_NV: if (new_type < SVt_PVNV) @@ -1580,9 +1580,8 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 new_type) new_body_arenaroot = &PL_body_arenaroots[SVt_PVIV]; /* XXX Is this still needed? Was it ever needed? Surely as there is no route from NV to PVIV, NOK can never be true */ - if (SvNIOK(sv)) - (void)SvIOK_on(sv); - SvNOK_off(sv); + assert(!SvNOKp(sv)); + assert(!SvNOK(sv)); goto new_body_no_NV; case SVt_PV: new_body_offset = - bodies_by_type[SVt_PV].offset; |