summaryrefslogtreecommitdiff
path: root/handy.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2021-03-27 12:14:45 -0600
committerKarl Williamson <khw@cpan.org>2022-06-12 09:50:10 -0600
commit31e89ad7f626c707a0da1096752d16613f5a98a8 (patch)
tree3214488ea9ae9a0e321e170457ac23650a49c470 /handy.h
parent4a283f4fd171ac8daa68fa3ebacb9aef8d126283 (diff)
downloadperl-31e89ad7f626c707a0da1096752d16613f5a98a8.tar.gz
handy.h: Collapse some macros
These 3 sets of macros can be collapsed trivially into 3 macros.
Diffstat (limited to 'handy.h')
-rw-r--r--handy.h17
1 files changed, 6 insertions, 11 deletions
diff --git a/handy.h b/handy.h
index 1a60145659..1e23828296 100644
--- a/handy.h
+++ b/handy.h
@@ -1977,12 +1977,11 @@ END_EXTERN_C
* conform to the Unicode standard. */
/* This does not handle the anomalies in UTF-8 Turkic locales. */
-#define generic_toLOWER_LC_(c, function) \
- ((! FITS_IN_8_BITS(c)) \
+# define toLOWER_LC(c) ((! FITS_IN_8_BITS(c)) \
? (c) \
: ((IN_UTF8_CTYPE_LOCALE) \
? PL_latin1_lc[ (U8) (c) ] \
- : (U8) function((U8) (c))))
+ : (U8) tolower((U8) (c))))
/* In this macro, note that the result can be larger than a byte in a UTF-8
* locale. It returns a single value, so can't adequately return the upper
@@ -1990,11 +1989,11 @@ END_EXTERN_C
* string of two values "SS"); instead it asserts against that under
* DEBUGGING, and otherwise returns its input. It does not handle the
* anomalies in UTF-8 Turkic locales. */
-#define generic_toUPPER_LC_(c, function) \
+# define toUPPER_LC(c) \
((! FITS_IN_8_BITS(c)) \
? (c) \
: ((! IN_UTF8_CTYPE_LOCALE) \
- ? (U8) function((U8) (c)) \
+ ? (U8) toupper((U8) (c)) \
: (UNLIKELY(((U8)(c)) == MICRO_SIGN) \
? GREEK_CAPITAL_LETTER_MU \
: ((UNLIKELY(((U8) (c)) == LATIN_SMALL_LETTER_Y_WITH_DIAERESIS) \
@@ -2009,16 +2008,12 @@ END_EXTERN_C
* two values "ss"); instead it asserts against that under DEBUGGING, and
* otherwise returns its input. It does not handle the anomalies in UTF-8
* Turkic locales */
-#define generic_toFOLD_LC_(c, function) \
+# define toFOLD_LC(c) \
((UNLIKELY((c) == MICRO_SIGN) && IN_UTF8_CTYPE_LOCALE) \
? GREEK_SMALL_LETTER_MU \
: (__ASSERT_( ! IN_UTF8_CTYPE_LOCALE \
|| LIKELY((c) != LATIN_SMALL_LETTER_SHARP_S)) \
- generic_toLOWER_LC_(c, function)))
-
-# define toLOWER_LC(c) generic_toLOWER_LC_((c), tolower)
-# define toUPPER_LC(c) generic_toUPPER_LC_((c), toupper)
-# define toFOLD_LC(c) generic_toFOLD_LC_((c), tolower)
+ toLOWER_LC(c)))
#endif
#define isIDCONT(c) isWORDCHAR(c)