aboutsummaryrefslogtreecommitdiffstats
path: root/support/regex_internal.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2020-11-06 14:17:43 +0200
committerArnold D. Robbins <arnold@skeeve.com>2020-11-06 14:17:43 +0200
commit793fc4309e655d68ba2972fb0e7c4be4346424ea (patch)
tree04f6abe151269fd023d86cd4b85c699068e51099 /support/regex_internal.c
parent22ca86022481cbdfbdc3a2a1f0977735067b2447 (diff)
parent1dbaf410e0b3ec754ee4ab78f861d4ef034e7962 (diff)
downloadegawk-793fc4309e655d68ba2972fb0e7c4be4346424ea.tar.gz
egawk-793fc4309e655d68ba2972fb0e7c4be4346424ea.tar.bz2
egawk-793fc4309e655d68ba2972fb0e7c4be4346424ea.zip
Merge branch 'master' into feature/cmp_scalars
Diffstat (limited to 'support/regex_internal.c')
-rw-r--r--support/regex_internal.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/support/regex_internal.c b/support/regex_internal.c
index e1b6b4d5..ed0a1346 100644
--- a/support/regex_internal.c
+++ b/support/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;