summaryrefslogtreecommitdiff
path: root/scope.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2010-04-15 10:20:50 +0100
committerDavid Mitchell <davem@iabyn.com>2010-04-15 10:32:59 +0100
commitf2338a2e8347fc967ab6b9af21d948258b88e341 (patch)
treeac9b735cf41f4c61d74904471fdbdd84297fdeeb /scope.c
parentdb63319f533e643ef6aac622fcae9a2f7ceabb0d (diff)
downloadperl-f2338a2e8347fc967ab6b9af21d948258b88e341.tar.gz
use cBOOL for bool casts
bool b = (bool)some_int doesn't necessarily do what you think. In some builds, bool is defined as char, and that cast's behaviour is thus undefined. So this line in mg.c: const bool was_temp = (bool)SvTEMP(sv); was actually setting was_temp to false even when the SVs_TEMP flag was set. Fix this by replacing all the (bool) casts with a new cBOOL() cast macro that (hopefully) does the right thing.
Diffstat (limited to 'scope.c')
-rw-r--r--scope.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/scope.c b/scope.c
index 994151e676..2a9d2d0772 100644
--- a/scope.c
+++ b/scope.c
@@ -780,7 +780,7 @@ Perl_leave_scope(pTHX_ I32 base)
break;
case SAVEt_BOOL: /* bool reference */
ptr = SSPOPPTR;
- *(bool*)ptr = (bool)SSPOPBOOL;
+ *(bool*)ptr = cBOOL(SSPOPBOOL);
break;
case SAVEt_I32: /* I32 reference */
ptr = SSPOPPTR;