This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix (probable) bug-by-inspection - CxREALEVAL(), CxTRYBLOCK(),
authorNicholas Clark <nick@ccl4.org>
Sun, 20 Jan 2008 17:39:22 +0000 (17:39 +0000)
committerNicholas Clark <nick@ccl4.org>
Sun, 20 Jan 2008 17:39:22 +0000 (17:39 +0000)
CxFOREACH() and CxFOREACHDEF() should all be masking against
CXTYPEMASK rather than their own type number.

p4raw-id: //depot/perl@33011

cop.h

diff --git a/cop.h b/cop.h
index d8c4961..21aeb22 100644 (file)
--- a/cop.h
+++ b/cop.h
@@ -677,13 +677,13 @@ struct context {
 #define CxTYPE(c)      ((c)->cx_type & CXTYPEMASK)
 #define CxMULTICALL(c) (((c)->cx_type & CXp_MULTICALL)                 \
                         == CXp_MULTICALL)
-#define CxREALEVAL(c)  (((c)->cx_type & (CXt_EVAL|CXp_REAL))           \
+#define CxREALEVAL(c)  (((c)->cx_type & (CXTYPEMASK|CXp_REAL))         \
                         == (CXt_EVAL|CXp_REAL))
-#define CxTRYBLOCK(c)  (((c)->cx_type & (CXt_EVAL|CXp_TRYBLOCK))       \
+#define CxTRYBLOCK(c)  (((c)->cx_type & (CXTYPEMASK|CXp_TRYBLOCK))     \
                         == (CXt_EVAL|CXp_TRYBLOCK))
-#define CxFOREACH(c)   (((c)->cx_type & (CXt_LOOP|CXp_FOREACH))        \
+#define CxFOREACH(c)   (((c)->cx_type & (CXTYPEMASK|CXp_FOREACH))      \
                          == (CXt_LOOP|CXp_FOREACH))
-#define CxFOREACHDEF(c)        (((c)->cx_type & (CXt_LOOP|CXp_FOREACH|CXp_FOR_DEF))\
+#define CxFOREACHDEF(c)        (((c)->cx_type & (CXTYPEMASK|CXp_FOREACH|CXp_FOR_DEF))\
                         == (CXt_LOOP|CXp_FOREACH|CXp_FOR_DEF))
 
 #define CXINC (cxstack_ix < cxstack_max ? ++cxstack_ix : (cxstack_ix = cxinc()))