diff options
author | Karl Berry <karl@freefriends.org> | 2020-09-25 08:03:18 -0700 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-09-25 08:03:18 -0700 |
commit | 5fd2323a63fc8214718db689743d13c25f5cc9cb (patch) | |
tree | d0365e6ee55fa727df802e6d8f2185a0991168b5 /lib | |
parent | 0c487ff1286660c4d572c3277e73ac6618ba832d (diff) | |
download | gnulib-5fd2323a63fc8214718db689743d13c25f5cc9cb.tar.gz |
autoupdate
Diffstat (limited to 'lib')
-rw-r--r-- | lib/regex_internal.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/regex_internal.c b/lib/regex_internal.c index ed0a13461b..e1b6b4d5af 100644 --- a/lib/regex_internal.c +++ b/lib/regex_internal.c @@ -300,20 +300,18 @@ 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 (ch) && mbsinit (&pstr->cur_state)) + if (isascii (pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx]) + && 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. */ - wchar_t wcu = __towupper (ch); - if (isascii (wcu)) - { - pstr->mbs[byte_idx] = wcu; - pstr->wcs[byte_idx] = wcu; - byte_idx++; - continue; - } + pstr->wcs[byte_idx] = (wchar_t) pstr->mbs[byte_idx]; + ++byte_idx; + continue; } remain_len = end_idx - byte_idx; @@ -350,6 +348,7 @@ 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; |