From: Paul Eggert Date: Fri, 25 Sep 2020 21:38:06 +0000 (-0700) Subject: regex: no longer match glibc X-Git-Tag: v1.0~3605 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=9682f18e98819a676c79f613f19e70c9413f2e5d;p=gnulib.git regex: no longer match glibc * config/srclist.txt: Comment out regex_internal.c for now. --- diff --git a/ChangeLog b/ChangeLog index 5c4d8f8492..2ed322e68c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2020-09-25 Paul Eggert + + regex: no longer match glibc + * config/srclist.txt: Comment out regex_internal.c for now. + 2020-09-23 Paul Eggert regex: fix ignore-case Turkish bug diff --git a/config/srclist.txt b/config/srclist.txt index c1ac3e1a18..02e8438294 100644 --- a/config/srclist.txt +++ b/config/srclist.txt @@ -57,7 +57,7 @@ $LIBCSRC malloc/scratch_buffer_set_array_size.c lib/malloc #$LIBCSRC posix/regcomp.c lib $LIBCSRC posix/regex.c lib #$LIBCSRC posix/regex.h lib -$LIBCSRC posix/regex_internal.c lib +#$LIBCSRC posix/regex_internal.c lib #$LIBCSRC posix/regex_internal.h lib $LIBCSRC posix/regexec.c lib $LIBCSRC time/timegm.c lib diff --git a/lib/regex_internal.c b/lib/regex_internal.c index e1b6b4d5af..ed0a13461b 100644 --- a/lib/regex_internal.c +++ b/lib/regex_internal.c @@ -300,18 +300,20 @@ build_wcs_upper_buffer (re_string_t *pstr) while (byte_idx < end_idx) { wchar_t wc; + unsigned char ch = pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx]; - if (isascii (pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx]) - && mbsinit (&pstr->cur_state)) + if (isascii (ch) && mbsinit (&pstr->cur_state)) { - /* In case of a singlebyte character. */ - pstr->mbs[byte_idx] - = toupper (pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx]); /* The next step uses the assumption that wchar_t is encoded ASCII-safe: all ASCII values can be converted like this. */ - pstr->wcs[byte_idx] = (wchar_t) pstr->mbs[byte_idx]; - ++byte_idx; - continue; + wchar_t wcu = __towupper (ch); + if (isascii (wcu)) + { + pstr->mbs[byte_idx] = wcu; + pstr->wcs[byte_idx] = wcu; + byte_idx++; + continue; + } } remain_len = end_idx - byte_idx; @@ -348,7 +350,6 @@ build_wcs_upper_buffer (re_string_t *pstr) { /* It is an invalid character, an incomplete character at the end of the string, or '\0'. Just use the byte. */ - int ch = pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx]; pstr->mbs[byte_idx] = ch; /* And also cast it to wide char. */ pstr->wcs[byte_idx++] = (wchar_t) ch;