From: Nicholas Clark Date: Wed, 14 Dec 2005 14:08:24 +0000 (+0000) Subject: Simplify the SvGMAGIC code in sv_2nv, removing duplicated checks to X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=47a72cb8cdd89092524c4dfa4bb85802a951515f;p=p5sagit%2Fp5-mst-13.2.git Simplify the SvGMAGIC code in sv_2nv, removing duplicated checks to warn for uninitialized values. p4raw-id: //depot/perl@26353 --- diff --git a/sv.c b/sv.c index 30193b0..8ba8eb0 100644 --- a/sv.c +++ b/sv.c @@ -2054,20 +2054,17 @@ Perl_sv_2nv(pTHX_ register SV *sv) return (NV)SvUVX(sv); else return (NV)SvIVX(sv); - } - if (!SvROK(sv)) { - if (!(SvFLAGS(sv) & SVs_PADTMP)) { - if (!PL_localizing && ckWARN(WARN_UNINITIALIZED)) - report_uninit(sv); - } - return (NV)0; - } - /* Else this will drop through into the SvROK case just below, which - will return within the {} for all code paths. */ - } - if (SvTHINKFIRST(sv)) { + } + if (SvROK(sv)) { + goto return_rok; + } + assert(SvTYPE(sv) >= SVt_PVMG); + /* This falls through to the report_uninit near the end of the + function. */ + } else if (SvTHINKFIRST(sv)) { if (SvROK(sv)) { SV* tmpstr; + return_rok: if (SvAMAGIC(sv) && (tmpstr=AMG_CALLun(sv,numer)) && (!SvROK(tmpstr) || (SvRV(tmpstr) != SvRV(sv)))) return SvNV(tmpstr);