[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: importing regex changes from libc
From: |
Paul Eggert |
Subject: |
Re: importing regex changes from libc |
Date: |
Fri, 11 Aug 2006 11:31:27 -0700 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
Eric Blake <address@hidden> writes:
> How about this? Paul, do you want to handle pushing it back upstream to
> glibc?
Sure, I'll add it to my long list of changes to push back upstream. :-)
Thanks for the bug report and patch. I like the following a bit
better, since it more closely matches the style of the existing code.
I installed it.
2006-08-11 Paul Eggert <address@hidden>
* regex_internal.c (re_string_skip_chars): Don't assume WEOF fits
in wchar_t. Problem reported by Eric Blake.
--- lib/regex_internal.c 10 Aug 2006 20:08:01 -0000 1.21
+++ lib/regex_internal.c 11 Aug 2006 18:28:44 -0000 1.22
@@ -488,16 +488,17 @@ re_string_skip_chars (re_string_t *pstr,
mbstate_t prev_st;
Idx rawbuf_idx;
size_t mbclen;
- wchar_t wc = WEOF;
+ wint_t wc = WEOF;
/* Skip the characters which are not necessary to check. */
for (rawbuf_idx = pstr->raw_mbs_idx + pstr->valid_raw_len;
rawbuf_idx < new_raw_idx;)
{
+ wchar_t wc2;
Idx remain_len;
remain_len = pstr->len - rawbuf_idx;
prev_st = pstr->cur_state;
- mbclen = mbrtowc (&wc, (const char *) pstr->raw_mbs + rawbuf_idx,
+ mbclen = mbrtowc (&wc2, (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))
{
@@ -509,10 +510,12 @@ re_string_skip_chars (re_string_t *pstr,
mbclen = 1;
pstr->cur_state = prev_st;
}
+ else
+ wc = wc2;
/* Then proceed the next character. */
rawbuf_idx += mbclen;
}
- *last_wc = (wint_t) wc;
+ *last_wc = wc;
return rawbuf_idx;
}
#endif /* RE_ENABLE_I18N */