diff options
author | Karl Williamson <khw@cpan.org> | 2022-10-08 06:49:01 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2022-10-10 13:22:11 -0600 |
commit | f41910bf9320ae3f1312f3e832504e8b03da3f00 (patch) | |
tree | f0d730d52ec211c288eda17a6020e4c41dd35d5d /pp.c | |
parent | 7a615b719074d2537dcc9f9c87ef4b4795182579 (diff) | |
download | perl-f41910bf9320ae3f1312f3e832504e8b03da3f00.tar.gz |
handy.h: Set macro to false if can't ever be true
It's unlikely that perl will be compiled with out the LC_CTYPE locale
category being enabled. But if it isn't, there is no sense in having
per-interpreter variables for various conditions in it, and no sense
having code that tests those variables.
This commit changes a macro to always yield 'false' when this is
disabled, adds a new similar macro, and changes some occurrences that
test for a variable to use the macros instead of the variables. That
way the compiler knows these to conditions can never be true.
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -3846,7 +3846,7 @@ PP(pp_ucfirst) * call to lowercase above has handled this. But SpecialCasing.txt * says we are supposed to remove the COMBINING DOT ABOVE. We can * tell if we have this situation if I ==> i in a turkic locale. */ - if ( UNLIKELY(PL_in_utf8_turkic_locale) + if ( UNLIKELY(IN_UTF8_TURKIC_LOCALE) && IN_LC_RUNTIME(LC_CTYPE) && (UNLIKELY(*s == 'I' && tmpbuf[0] == 'i'))) { @@ -3890,7 +3890,7 @@ PP(pp_ucfirst) #ifdef USE_LOCALE_CTYPE if (IN_LC_RUNTIME(LC_CTYPE)) { - if ( UNLIKELY(PL_in_utf8_turkic_locale) + if ( UNLIKELY(IN_UTF8_TURKIC_LOCALE) && ( (op_type == OP_LCFIRST && UNLIKELY(*s == 'I')) || (op_type == OP_UCFIRST && UNLIKELY(*s == 'i')))) { @@ -4292,7 +4292,7 @@ PP(pp_uc) #ifdef USE_LOCALE_CTYPE - && (LIKELY( ! PL_in_utf8_turkic_locale + && (LIKELY( ! IN_UTF8_TURKIC_LOCALE || ! IN_LC_RUNTIME(LC_CTYPE)) || *s != 'i') #endif @@ -4398,7 +4398,7 @@ PP(pp_uc) * its own loop */ #ifdef USE_LOCALE_CTYPE - if ( UNLIKELY(PL_in_utf8_turkic_locale) + if ( UNLIKELY(IN_UTF8_TURKIC_LOCALE) && UNLIKELY(IN_LC_RUNTIME(LC_CTYPE))) { for (; s < send; s++) { @@ -4464,7 +4464,7 @@ PP(pp_lc) #ifdef USE_LOCALE_CTYPE && ( LIKELY(! IN_LC_RUNTIME(LC_CTYPE)) - || LIKELY(! PL_in_utf8_turkic_locale)) + || LIKELY(! IN_UTF8_TURKIC_LOCALE)) #endif @@ -4500,7 +4500,7 @@ PP(pp_lc) /* Lowercasing in a Turkic locale can cause non-UTF-8 to need to become * UTF-8 for the single case of the character 'I' */ - if ( UNLIKELY(PL_in_utf8_turkic_locale) + if ( UNLIKELY(IN_UTF8_TURKIC_LOCALE) && ! DO_UTF8(source) && (next_I = (U8 *) memchr(s, 'I', len))) { @@ -4557,7 +4557,7 @@ PP(pp_lc) * and if so, do it. We know that there is a DOT because * _toLOWER_utf8_flags() wouldn't have returned 'i' unless there * was one in a proper position. */ - if ( UNLIKELY(PL_in_utf8_turkic_locale) + if ( UNLIKELY(IN_UTF8_TURKIC_LOCALE) && IN_LC_RUNTIME(LC_CTYPE)) { if ( UNLIKELY(remove_dot_above) @@ -4849,7 +4849,7 @@ PP(pp_fc) for (; s < send; d++, s++) { if ( UNLIKELY(*s == MICRO_SIGN) #ifdef USE_LOCALE_CTYPE - || ( UNLIKELY(PL_in_utf8_turkic_locale) + || ( UNLIKELY(IN_UTF8_TURKIC_LOCALE) && UNLIKELY(IN_LC_RUNTIME(LC_CTYPE)) && UNLIKELY(*s == 'I')) #endif |