summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-12-14 14:08:24 +0000
committerNicholas Clark <nick@ccl4.org>2005-12-14 14:08:24 +0000
commit47a72cb8cdd89092524c4dfa4bb85802a951515f (patch)
tree59155ca05000a712a0cb1b17ca45dd53029449d9 /sv.c
parent7e25a7e974022d38c0b211f280644364acb3c3ee (diff)
downloadperl-47a72cb8cdd89092524c4dfa4bb85802a951515f.tar.gz
Simplify the SvGMAGIC code in sv_2nv, removing duplicated checks to
warn for uninitialized values. p4raw-id: //depot/perl@26353
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/sv.c b/sv.c
index 30193b0424..8ba8eb0ff9 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);