From: Nicholas Clark Date: Fri, 18 Nov 2005 11:20:10 +0000 (+0000) Subject: Simplify the expression for the upgrade logic for SVt_IV. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a95c302be5eb00c1f54619017ae777b107c54275;p=p5sagit%2Fp5-mst-13.2.git 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 --- diff --git a/sv.c b/sv.c index e7355b7..fdd9a65 100644 --- a/sv.c +++ b/sv.c @@ -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;