summaryrefslogtreecommitdiff
path: root/sv.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-05-25 23:59:45 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-05-26 00:18:23 -0700
commit762dbf22cb22645771fc27b5d197fd40cbbd9da8 (patch)
tree996e137a38e7dbeccd2719a7c0b09c848ad0d4e0 /sv.h
parentab830aa00cac1e0b1157a24d5df949dbcfa4dc40 (diff)
downloadperl-762dbf22cb22645771fc27b5d197fd40cbbd9da8.tar.gz
[perl #118159] Make PVs take precedence in SvTRUE
Commit 4bac9ae4 (probably inadvertently) changed SvTRUE to treat an SV with any of PVX, IVX or NVX having a true value as true. Traditionally, truth was based solely on stringification. The examina- tion of the SvIVX and SvNVX slots was for those cases where there was no string already and it could be deduced from IVX or NVX whether it would stringify as "0" or no (bugs with -0 aside). This changes things back to the way they have ‘always’ been.
Diffstat (limited to 'sv.h')
-rw-r--r--sv.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/sv.h b/sv.h
index 98aef7a5fa..449b23e519 100644
--- a/sv.h
+++ b/sv.h
@@ -1738,9 +1738,10 @@ Like sv_utf8_upgrade, but doesn't do magic on C<sv>.
#define SvTRUE_common(sv,fallback) ( \
!SvOK(sv) \
? 0 \
- : (SvFLAGS(sv) & (SVf_POK|SVf_IOK|SVf_NOK)) \
- ? ( (SvPOK(sv) && SvPVXtrue(sv)) \
- || (SvIOK(sv) && SvIVX(sv) != 0) \
+ : SvPOK(sv) \
+ ? SvPVXtrue(sv) \
+ : (SvFLAGS(sv) & (SVf_IOK|SVf_NOK)) \
+ ? ( (SvIOK(sv) && SvIVX(sv) != 0) \
|| (SvNOK(sv) && SvNVX(sv) != 0.0)) \
: (fallback))