diff options
author | Karl Williamson <public@khwilliamson.com> | 2014-02-03 11:52:24 -0700 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2014-02-03 12:06:41 -0700 |
commit | 95f34b6fc646073944e61496c615de11b8bca7da (patch) | |
tree | 810862b177e4b5bb7a2d830aaaad53ba9a03a982 | |
parent | b3a2acfa0c0e4f8e48e1f6eb4d6fd143f293d2c6 (diff) | |
download | perl-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.
-rw-r--r-- | handy.h | 4 | ||||
-rw-r--r-- | regcomp.c | 21 |
2 files changed, 2 insertions, 23 deletions
@@ -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 */ @@ -13682,9 +13682,6 @@ parseit: #ifndef HAS_ISASCII && classnum != _CC_ASCII #endif -#ifndef HAS_ISBLANK - && classnum != _CC_BLANK -#endif ) { /* See if it already matches the complement of this POSIX @@ -13768,16 +13765,6 @@ parseit: ? &posixes : &nposixes; SV** source_ptr = &PL_XPosix_ptrs[classnum]; -#ifndef HAS_ISBLANK - /* If the platform doesn't have isblank(), we handle locale - * with the hardcoded ASII values. */ - if (LOC && classnum == _CC_BLANK) { - _invlist_subtract(*source_ptr, - PL_UpperLatin1, - source_ptr); - } -#endif - _invlist_union_maybe_complement_2nd( *posixes_ptr, *source_ptr, @@ -14145,14 +14132,6 @@ parseit: if (op > POSIXA) { /* /aa is same as /a */ op = POSIXA; } -#ifndef HAS_ISBLANK - if (op == POSIXL - && (namedclass == ANYOF_BLANK - || namedclass == ANYOF_NBLANK)) - { - op = POSIXA; - } -#endif join_posix: /* The odd numbered ones are the complements of the |