summaryrefslogtreecommitdiff
path: root/handy.h
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2014-02-03 11:52:24 -0700
committerKarl Williamson <public@khwilliamson.com>2014-02-03 12:06:41 -0700
commit95f34b6fc646073944e61496c615de11b8bca7da (patch)
tree810862b177e4b5bb7a2d830aaaad53ba9a03a982 /handy.h
parentb3a2acfa0c0e4f8e48e1f6eb4d6fd143f293d2c6 (diff)
downloadperl-95f34b6fc646073944e61496c615de11b8bca7da.tar.gz
Fix [[:blank:]] handling when no isblank() on platform
isblank() is a C99 construct, Perl tries to handle the use of this on C89 platforms by using the standard hard-coded definition. However, this code was not updated to account for UTF-8 locales when handling for those was recently added (31f05a37c), since in a UTF-8 locale the no-break space is also considered to be a blank. This commit fixes that. Previously regcomp.c generated the hard-coded definitions when there was no isblank(), using #ifdef'd code. That special handling was removed, and [:blank:] is always treated just like any other POSIX class. The specialness of it is hidden entirely in handy.h. This simplifies the regcomp.c code slightly. I considered removing the special handling for isascii(), also a C99 construct, in the name of simplicity over the slight speed that would be lost. But the special handling is only a single line in two places, so I left it in.
Diffstat (limited to 'handy.h')
-rw-r--r--handy.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/handy.h b/handy.h
index 88150846af..d695cf5183 100644
--- a/handy.h
+++ b/handy.h
@@ -1325,8 +1325,8 @@ EXTCONST U32 PL_charclass[];
#if defined(HAS_ISBLANK) && ! defined(USE_NEXT_CTYPE)
# define isBLANK_LC(c) _generic_LC(c, _CC_BLANK, isblank)
-#else
-# define isBLANK_LC(c) isBLANK(c)
+#else /* Unlike isASCII, varies if in a UTF-8 locale */
+# define isBLANK_LC(c) (IN_UTF8_CTYPE_LOCALE) ? isBLANK_L1(c) : isBLANK(c)
#endif
#ifdef USE_NEXT_CTYPE /* NeXT computers */