diff options
author | Ulrich Drepper <drepper@redhat.com> | 2009-01-08 00:23:09 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2009-01-08 00:23:09 +0000 |
commit | b3918c7d7f99828d23232d0aaf4056f8fae9898e (patch) | |
tree | 317ef6202dc86daa7a351a045c355407aeb29a7c /posix | |
parent | df9293cb169bf848be529381ca43680aa192421e (diff) | |
download | glibc-b3918c7d7f99828d23232d0aaf4056f8fae9898e.tar.gz |
* posix/regcomp.c (re_compile_fastmap_iter): Use __mbrtowc.
* posix/regex_internal.c (build_wcs_buffer, build_wcs_upper_buffer,
re_string_skip_chars, re_string_reconstruct): Likewise.
* posix/regex_internal.h [!_LIBC] (__mbrtowc): New #define.
Diffstat (limited to 'posix')
-rw-r--r-- | posix/regcomp.c | 4 | ||||
-rw-r--r-- | posix/regex_internal.c | 18 | ||||
-rw-r--r-- | posix/regex_internal.h | 1 |
3 files changed, 12 insertions, 11 deletions
diff --git a/posix/regcomp.c b/posix/regcomp.c index 8ba7668e8b..d5a0535e9a 100644 --- a/posix/regcomp.c +++ b/posix/regcomp.c @@ -327,8 +327,8 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state, && 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 + if (__mbrtowc (&wc, (const char *) buf, p - buf, + &state) == p - buf && (__wcrtomb ((char *) buf, towlower (wc), &state) != (size_t) -1)) re_set_fastmap (fastmap, 0, buf[0]); diff --git a/posix/regex_internal.c b/posix/regex_internal.c index 01a432e801..c9da2b961c 100644 --- a/posix/regex_internal.c +++ b/posix/regex_internal.c @@ -229,7 +229,7 @@ build_wcs_buffer (re_string_t *pstr) } else p = (const char *) pstr->raw_mbs + pstr->raw_mbs_idx + byte_idx; - mbclen = mbrtowc (&wc, p, remain_len, &pstr->cur_state); + mbclen = __mbrtowc (&wc, p, remain_len, &pstr->cur_state); if (BE (mbclen == (size_t) -2, 0)) { /* The buffer doesn't have enough space, finish to build. */ @@ -299,9 +299,9 @@ build_wcs_upper_buffer (re_string_t *pstr) remain_len = end_idx - byte_idx; prev_st = pstr->cur_state; - mbclen = mbrtowc (&wc, - ((const char *) pstr->raw_mbs + pstr->raw_mbs_idx - + byte_idx), remain_len, &pstr->cur_state); + mbclen = __mbrtowc (&wc, + ((const char *) pstr->raw_mbs + pstr->raw_mbs_idx + + byte_idx), remain_len, &pstr->cur_state); if (BE (mbclen + 2 > 2, 1)) { wchar_t wcu = wc; @@ -369,7 +369,7 @@ build_wcs_upper_buffer (re_string_t *pstr) } else p = (const char *) pstr->raw_mbs + pstr->raw_mbs_idx + src_idx; - mbclen = mbrtowc (&wc, p, remain_len, &pstr->cur_state); + mbclen = __mbrtowc (&wc, p, remain_len, &pstr->cur_state); if (BE (mbclen + 2 > 2, 1)) { wchar_t wcu = wc; @@ -491,8 +491,8 @@ re_string_skip_chars (re_string_t *pstr, int new_raw_idx, wint_t *last_wc) int remain_len; remain_len = pstr->len - rawbuf_idx; prev_st = pstr->cur_state; - mbclen = mbrtowc (&wc, (const char *) pstr->raw_mbs + rawbuf_idx, - remain_len, &pstr->cur_state); + mbclen = __mbrtowc (&wc, (const char *) pstr->raw_mbs + rawbuf_idx, + remain_len, &pstr->cur_state); if (BE (mbclen == (size_t) -2 || mbclen == (size_t) -1 || mbclen == 0, 0)) { /* We treat these cases as a single byte character. */ @@ -734,8 +734,8 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags) /* XXX Don't use mbrtowc, we know which conversion to use (UTF-8 -> UCS4). */ memset (&cur_state, 0, sizeof (cur_state)); - mbclen = mbrtowc (&wc2, (const char *) p, mlen, - &cur_state); + mbclen = __mbrtowc (&wc2, (const char *) p, mlen, + &cur_state); if (raw + offset - p <= mbclen && mbclen < (size_t) -2) { diff --git a/posix/regex_internal.h b/posix/regex_internal.h index 79266781b8..65a9905860 100644 --- a/posix/regex_internal.h +++ b/posix/regex_internal.h @@ -116,6 +116,7 @@ # define __wctype wctype # define __iswctype iswctype # define __btowc btowc +# define __mbrtowc mbrtowc # define __mempcpy mempcpy # define __wcrtomb wcrtomb # define __regfree regfree |