Skip to content

Commit

Permalink
handy.h: Rmv unnecessary parameter to internal macros
Browse files Browse the repository at this point in the history
The cast is required to be U8 by the POSIX standard.  There is no need
to have this added generality.
  • Loading branch information
khwilliamson committed Apr 30, 2021
1 parent 74b3a87 commit 7b40d96
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions handy.h
Expand Up @@ -1886,24 +1886,24 @@ END_EXTERN_C
* system function is defective; it ensures uniform results that conform to the
* Unicode standard. It does not handle the anomalies in UTF-8 Turkic
* locales. */
#define generic_toLOWER_LC_(c, function, cast) \
#define generic_toLOWER_LC_(c, function) \
(! FITS_IN_8_BITS(c) \
? (c) \
: (IN_UTF8_CTYPE_LOCALE) \
? PL_latin1_lc[ (U8) (c) ] \
: (cast)function((cast)(c)))
: (U8) function((U8) (c)))

/* 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 case of LATIN
* SMALL LETTER SHARP S in a UTF-8 locale (which should be a 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, cast) \
#define generic_toUPPER_LC_(c, function) \
(! FITS_IN_8_BITS(c) \
? (c) \
: ((! IN_UTF8_CTYPE_LOCALE) \
? (cast)function((cast)(c)) \
? (U8) function((U8) (c)) \
: (UNLIKELY(((U8)(c)) == MICRO_SIGN) \
? GREEK_CAPITAL_LETTER_MU \
: (UNLIKELY(((U8)(c)) == LATIN_SMALL_LETTER_Y_WITH_DIAERESIS) \
Expand All @@ -1918,12 +1918,12 @@ END_EXTERN_C
* 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, cast) \
#define generic_toFOLD_LC_(c, function) \
((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, cast)))
generic_toLOWER_LC_(c, function)))

/* Use the libc versions for these if available. */
#if defined(HAS_ISASCII)
Expand All @@ -1948,9 +1948,9 @@ END_EXTERN_C
# define isIDFIRST_LC(c) (UNLIKELY((c) == '_') || isALPHA_LC(c))
# define isWORDCHAR_LC(c) (UNLIKELY((c) == '_') || isALPHANUMERIC_LC(c))

# define toLOWER_LC(c) generic_toLOWER_LC_((c), tolower, U8)
# define toUPPER_LC(c) generic_toUPPER_LC_((c), toupper, U8)
# define toFOLD_LC(c) generic_toFOLD_LC_((c), tolower, U8)
# 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)

# ifdef WIN32

Expand Down

0 comments on commit 7b40d96

Please sign in to comment.