aboutsummaryrefslogtreecommitdiff
path: root/posix/regcomp.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-11-12 06:13:10 +0000
committerUlrich Drepper <drepper@redhat.com>2003-11-12 06:13:10 +0000
commit74e12fbc03bb19ee8cbd880d0def24409ce0c6f8 (patch)
treea4fbc770b743c6072293de5e210f07f7518a3af9 /posix/regcomp.c
parent8b965f3da4b948a10f232e5713a64cbb064d70ac (diff)
downloadglibc-74e12fbc03bb19ee8cbd880d0def24409ce0c6f8.zip
glibc-74e12fbc03bb19ee8cbd880d0def24409ce0c6f8.tar.gz
glibc-74e12fbc03bb19ee8cbd880d0def24409ce0c6f8.tar.bz2
Update.
2003-11-11 Jakub Jelinek <jakub@redhat.com> * posix/regcomp.c (re_compile_fastmap_iter): Handle RE_ICASE with MB_CUR_MAX > 1 locales in the fastmap. 2003-11-11 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.c (build_wcs_buffer): Fix comment typo. (build_wcs_upper_buffer): Likewise. Use towupper for wchar_t instead of toupper. * posix/Makefile (tests): Add bug-regex17 and bug-regex18. (bug-regex17-ENV, bug-regex18-ENV): Add LOCPATH. * posix/bug-regex18.c: New test.
Diffstat (limited to 'posix/regcomp.c')
-rw-r--r--posix/regcomp.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/posix/regcomp.c b/posix/regcomp.c
index b0093d9..2b85037 100644
--- a/posix/regcomp.c
+++ b/posix/regcomp.c
@@ -319,7 +319,29 @@ re_compile_fastmap_iter (bufp, init_state, fastmap)
re_token_type_t type = dfa->nodes[node].type;
if (type == CHARACTER)
- re_set_fastmap (fastmap, icase, dfa->nodes[node].opr.c);
+ {
+ re_set_fastmap (fastmap, icase, dfa->nodes[node].opr.c);
+#ifdef RE_ENABLE_I18N
+ if ((bufp->syntax & RE_ICASE) && !icase)
+ {
+ unsigned char *buf = alloca (MB_CUR_MAX), *p;
+ wchar_t wc;
+ mbstate_t state;
+
+ p = buf;
+ *p++ = dfa->nodes[node].opr.c;
+ while (++node < dfa->nodes_len
+ && dfa->nodes[node].type == CHARACTER
+ && dfa->nodes[node].mb_partial)
+ *p++ = dfa->nodes[node].opr.c;
+ memset (&state, 0, sizeof (state));
+ if (mbrtowc (&wc, (const char *) buf, p - buf,
+ &state) == p - buf
+ && __wcrtomb ((char *) buf, towlower (wc), &state) > 0)
+ re_set_fastmap (fastmap, 0, buf[0]);
+ }
+#endif
+ }
else if (type == SIMPLE_BRACKET)
{
int i, j, ch;
@@ -367,6 +389,11 @@ re_compile_fastmap_iter (bufp, init_state, fastmap)
memset (&state, '\0', sizeof (state));
__wcrtomb (buf, cset->mbchars[i], &state);
re_set_fastmap (fastmap, icase, *(unsigned char *) buf);
+ if ((bufp->syntax & RE_ICASE) && !icase)
+ {
+ __wcrtomb (buf, towlower (cset->mbchars[i]), &state);
+ re_set_fastmap (fastmap, 0, *(unsigned char *) buf);
+ }
}
}
#endif /* RE_ENABLE_I18N */