diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-05-25 23:59:45 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-05-26 00:18:23 -0700 |
commit | 762dbf22cb22645771fc27b5d197fd40cbbd9da8 (patch) | |
tree | 996e137a38e7dbeccd2719a7c0b09c848ad0d4e0 /sv.h | |
parent | ab830aa00cac1e0b1157a24d5df949dbcfa4dc40 (diff) | |
download | perl-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.h | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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)) |