summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2014-01-14 10:31:09 -0700
committerKarl Williamson <public@khwilliamson.com>2014-01-22 11:45:58 -0700
commitc8bf5ca7a1b77fe62bf76d50fc01635dcefb91be (patch)
treeb50a8ef3592dae56b1e3a4436a59c9c115b76038
parent37a519b2b9e6d87de805b7c3206e6e716e742fba (diff)
downloadperl-c8bf5ca7a1b77fe62bf76d50fc01635dcefb91be.tar.gz
Add some cBOOL casts to macros
I kept getting burned by these macros returning non-zero instead of a boolean, as they are used as bool parameters to functions. So I added cBOOLs to them.
-rw-r--r--perl.h12
-rw-r--r--pp.c8
2 files changed, 10 insertions, 10 deletions
diff --git a/perl.h b/perl.h
index 8c6cf5e797..b7dead9e80 100644
--- a/perl.h
+++ b/perl.h
@@ -5239,17 +5239,17 @@ typedef struct am_table_short AMTS;
#ifdef USE_LOCALE_NUMERIC
-/* Returns non-zero If the plain locale pragma without a parameter is in effect
+/* Returns TRUE if the plain locale pragma without a parameter is in effect
*/
-#define IN_LOCALE_RUNTIME (CopHINTS_get(PL_curcop) & HINT_LOCALE)
+#define IN_LOCALE_RUNTIME cBOOL(CopHINTS_get(PL_curcop) & HINT_LOCALE)
-/* Returns non-zero If either form of the locale pragma is in effect */
+/* Returns TRUE if either form of the locale pragma is in effect */
#define IN_SOME_LOCALE_FORM_RUNTIME \
- (CopHINTS_get(PL_curcop) & (HINT_LOCALE|HINT_LOCALE_NOT_CHARS))
+ cBOOL(CopHINTS_get(PL_curcop) & (HINT_LOCALE|HINT_LOCALE_NOT_CHARS))
-#define IN_LOCALE_COMPILETIME (PL_hints & HINT_LOCALE)
+#define IN_LOCALE_COMPILETIME cBOOL(PL_hints & HINT_LOCALE)
#define IN_SOME_LOCALE_FORM_COMPILETIME \
- (PL_hints & (HINT_LOCALE|HINT_LOCALE_NOT_CHARS))
+ cBOOL(PL_hints & (HINT_LOCALE|HINT_LOCALE_NOT_CHARS))
#define IN_LOCALE \
(IN_PERL_COMPILETIME ? IN_LOCALE_COMPILETIME : IN_LOCALE_RUNTIME)
diff --git a/pp.c b/pp.c
index 6925f496a1..22133b3834 100644
--- a/pp.c
+++ b/pp.c
@@ -3504,11 +3504,11 @@ PP(pp_ucfirst)
ulen = UTF8SKIP(s);
if (op_type == OP_UCFIRST) {
_to_utf8_title_flags(s, tmpbuf, &tculen,
- cBOOL(IN_LOCALE_RUNTIME), &tainted);
+ IN_LOCALE_RUNTIME, &tainted);
}
else {
_to_utf8_lower_flags(s, tmpbuf, &tculen,
- cBOOL(IN_LOCALE_RUNTIME), &tainted);
+ IN_LOCALE_RUNTIME, &tainted);
}
/* we can't do in-place if the length changes. */
@@ -3771,7 +3771,7 @@ PP(pp_uc)
u = UTF8SKIP(s);
uv = _to_utf8_upper_flags(s, tmpbuf, &ulen,
- cBOOL(IN_LOCALE_RUNTIME), &tainted);
+ IN_LOCALE_RUNTIME, &tainted);
#define GREEK_CAPITAL_LETTER_IOTA 0x0399
#define COMBINING_GREEK_YPOGEGRAMMENI 0x0345
if (uv == GREEK_CAPITAL_LETTER_IOTA
@@ -3977,7 +3977,7 @@ PP(pp_lc)
STRLEN ulen;
_to_utf8_lower_flags(s, tmpbuf, &ulen,
- cBOOL(IN_LOCALE_RUNTIME), &tainted);
+ IN_LOCALE_RUNTIME, &tainted);
/* Here is where we would do context-sensitive actions. See the
* commit message for 86510fb15 for why there isn't any */