PATCH: [perl #121109] locales failing
authorKarl Williamson <khw@cpan.org>
Wed, 29 Jan 2014 02:04:24 +0000 (03:04 +0100)
committerKarl Williamson <public@khwilliamson.com>
Wed, 29 Jan 2014 05:09:39 +0000 (22:09 -0700)
This was due to a logic error in toFOLD_LC() introduced in
31f05a37c4e9c37a7263491f2fc0237d836e1a80.  It affected only the code
point at 0xB5 and shows up only in locales in which the character at that
code point is an uppercase letter.

handy.h

diff --git a/handy.h b/handy.h
index c65170a..0a504bf 100644 (file)
--- a/handy.h
+++ b/handy.h
@@ -1310,13 +1310,11 @@ EXTCONST U32 PL_charclass[];
  * values "ss"); instead it asserts against that under DEBUGGING, and
  * otherwise returns its input */
 #define _generic_toFOLD_LC(c, function, cast)                                  \
-                    (LIKELY((c) != MICRO_SIGN)                                 \
-                    ? (__ASSERT_(! IN_UTF8_CTYPE_LOCALE                        \
-                                 || (c) != LATIN_SMALL_LETTER_SHARP_S)         \
-                       _generic_toLOWER_LC(c, function, cast))                 \
-                    : (IN_UTF8_CTYPE_LOCALE)                                   \
+                    ((UNLIKELY((c) == MICRO_SIGN) && IN_UTF8_CTYPE_LOCALE)     \
                       ? GREEK_SMALL_LETTER_MU                                  \
-                      : (c))
+                      : (__ASSERT_(! IN_UTF8_CTYPE_LOCALE                      \
+                                   || (c) != LATIN_SMALL_LETTER_SHARP_S)       \
+                         _generic_toLOWER_LC(c, function, cast)))
 
 /* Use the libc versions for these if available. */
 #if defined(HAS_ISASCII) && ! defined(USE_NEXT_CTYPE)