aboutsummaryrefslogtreecommitdiff
path: root/posix/regcomp.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2018-08-10 14:19:05 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2018-08-10 14:27:56 -0700
commitc77bf91b4315efed2b61633567acc7ac3c46959c (patch)
treeb4e3586e8e5e176fb29af83077ff6418e5246446 /posix/regcomp.c
parent2ce7ba7d15b0ea0ea90c6f57ba36e23d190d91bf (diff)
downloadglibc-c77bf91b4315efed2b61633567acc7ac3c46959c.tar
glibc-c77bf91b4315efed2b61633567acc7ac3c46959c.tar.gz
glibc-c77bf91b4315efed2b61633567acc7ac3c46959c.tar.bz2
glibc-c77bf91b4315efed2b61633567acc7ac3c46959c.zip
regex: Gnulib unibyte RRI uses bytes not chars
Adjust the non-glibc code to agree with what Gawk needs for rational range interpretation (RRI) for regular expression ranges. In unibyte locales, Gawk wants ranges to use the underlying byte rather than the character code point. This change does not affect glibc proper. * posix/regcomp.c (parse_byte) [!LIBC && RE_ENABLE_I18N]: In unibyte locales, use the byte value rather than running it through btowc.
Diffstat (limited to 'posix/regcomp.c')
-rw-r--r--posix/regcomp.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/posix/regcomp.c b/posix/regcomp.c
index 3b0a3c6b6a..e81652f229 100644
--- a/posix/regcomp.c
+++ b/posix/regcomp.c
@@ -2684,15 +2684,14 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
# ifdef RE_ENABLE_I18N
/* Convert the byte B to the corresponding wide character. In a
- unibyte locale, treat B as itself if it is an encoding error.
- In a multibyte locale, return WEOF if B is an encoding error. */
+ unibyte locale, treat B as itself. In a multibyte locale, return
+ WEOF if B is an encoding error. */
static wint_t
parse_byte (unsigned char b, re_charset_t *mbcset)
{
- wint_t wc = __btowc (b);
- return wc == WEOF && !mbcset ? b : wc;
+ return mbcset == NULL ? b : __btowc (b);
}
-#endif
+# endif
/* Local function for parse_bracket_exp only used in case of NOT _LIBC.
Build the range expression which starts from START_ELEM, and ends