diff options
author | Nicholas Clark <nick@ccl4.org> | 2012-01-16 16:21:21 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2012-01-16 16:21:21 +0100 |
commit | c8ca97b0f5c0db7ad9b35fc9c4bea37281bc79ff (patch) | |
tree | afcce7759ec7f388077b95ff5d7b7fbaaa361140 /toke.c | |
parent | 86e2f32949f588e0df48328ed7dfb2e90d8b142b (diff) | |
download | perl-c8ca97b0f5c0db7ad9b35fc9c4bea37281bc79ff.tar.gz |
In Perl_feature_is_enabled() use cBOOL to convert the pointer to a "bool".
On some platforms which don't have a (real) bool type, bool is actually a
char, and hence (sadly) it's correct for the compiler to truncate when
assigning to it, instead of what the programmer thought was going to happen
(testing zero or not). In Perl_feature_is_enabled(), the expression is a
pointer, so if it converts to an integer with the bottom 8 bits zero, then
on these platforms it would truncate to "false". Not what was expected.
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -614,11 +614,8 @@ Perl_feature_is_enabled(pTHX_ const char *const name, STRLEN namelen) return FALSE; memcpy(&he_name[8], name, namelen); - return - cop_hints_fetch_pvn( - PL_curcop, he_name, 8 + namelen, 0, - REFCOUNTED_HE_EXISTS - ); + return cBOOL(cop_hints_fetch_pvn(PL_curcop, he_name, 8 + namelen, 0, + REFCOUNTED_HE_EXISTS)); } /* |