From: Nicholas Clark Date: Thu, 28 Apr 2005 08:34:57 +0000 (+0000) Subject: The if() clause is the wrong way round, so OOK can never be true in X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c2bfdfaf3f7731071c0d7c0684c538dffecf7ac6;p=p5sagit%2Fp5-mst-13.2.git The if() clause is the wrong way round, so OOK can never be true in this case. Given that OOK is never undone, we could never have been correctly upgrading a PV with OOK to HV or AV. I believe that only SVt_NULL is the only type ever upgraded to HV or AV. p4raw-id: //depot/perl@24340 --- diff --git a/sv.c b/sv.c index ab9603f..0757341 100644 --- a/sv.c +++ b/sv.c @@ -1794,9 +1794,6 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt) if (SvTYPE(sv) == mt) return TRUE; - if (mt < SVt_PVIV) - (void)SvOOK_off(sv); - pv = NULL; cur = 0; len = 0; @@ -1907,6 +1904,11 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt) SvNV_set(sv, 0.0); } /* to here. */ + /* XXX? Only SVt_NULL is ever upgraded to AV or HV? */ + assert(!pv); + /* FIXME. Should be able to remove this if the above assertion is + genuinely always true. */ + (void)SvOOK_off(sv); if (pv) Safefree(pv); SvPV_set(sv, (char*)0);