Skip to content

Commit

Permalink
* posix/regcomp.c (re_compile_fastmap_iter): Use __mbrtowc.
Browse files Browse the repository at this point in the history
	* 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.
  • Loading branch information
Ulrich Drepper committed Jan 8, 2009
1 parent df9293c commit b3918c7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2008-12-31 Paolo Bonzini <bonzini@gnu.org>

* 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.

2008-12-31 Rafael Avila de Espindola <espindola@google.com>

* resolv/nss_dns/dns-host.c (_nss_dns_gethostbyaddr2_r): Check and
Expand Down
4 changes: 2 additions & 2 deletions posix/regcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
18 changes: 9 additions & 9 deletions posix/regex_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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. */
Expand Down Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions posix/regex_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b3918c7

Please sign in to comment.