fix parsing of s commands for MBCS codes including \x5c

2009-01-23  Paolo Bonzini  <bonzini@gnu.org>
	    Hideo AOKI <hideo.aoki.tk@hitachi.com>

	* sed/compile.c (match_slash): Fix MBCS behavior.
	* sed/sed.h (MBSINIT): New.
This commit is contained in:
Paolo Bonzini committed 2009-04-27 12:03:39 +02:00
1 parent 8299b37936
commit d3083e2ead
4 files changed
+14 -7

No files matched your search

+6
View File
@@ -1,3 +1,9 @@
2009-01-23 Paolo Bonzini <bonzini@gnu.org>
Hideo AOKI <hideo.aoki.tk@hitachi.com>
* sed/compile.c (match_slash): Fix MBCS behavior.
* sed/sed.h (MBSINIT): New.
2009-01-20 Paolo Bonzini <bonzini@gnu.org>
* autoboot.conf, bootstrap.sh.in: Remove memchr, memcmp, memmove
+1 -1
View File
@@ -19,7 +19,7 @@
# gnulib modules used by this package.
gnulib_modules="
acl alloca btowc extensions getline getopt gettext localcharset \
mbrlen mbrtowc mkstemp obstack pathmax snprintf stdbool \
mbrlen mbrtowc mbsinit mkstemp obstack pathmax snprintf stdbool \
stat-macros strerror strverscmp unlocked-io vasnprintf verify wcrtomb wctob"
SKIP_PO=t
+3 -6
View File
@@ -535,12 +535,11 @@ match_slash(slash, regex)
{
struct buffer *b;
int ch;
bool pending_mb = false;
mbstate_t cur_stat;
memset (&cur_stat, 0, sizeof (mbstate_t));
if (BRLEN (slash, &cur_stat) == -2)
/* We allow only 1 byte characters for a slash. */
if (BRLEN (slash, &cur_stat) == -2)
bad_prog (BAD_DELIM);
@@ -549,10 +548,8 @@ match_slash(slash, regex)
b = init_buffer();
while ((ch = inchar()) != EOF && ch != '\n')
{
pending_mb = BRLEN (ch, &cur_stat) != 1;
pending_mb = BRLEN (ch, &cur_stat) != 1;
if (!pending_mb)
bool pending_mb = !MBSINIT (&cur_stat);
if (BRLEN (ch, &cur_stat) == 1 && !pending_mb)
{
if (ch == slash)
return b;
+4
View File
@@ -261,6 +261,9 @@ extern bool is_utf8;
wcrtomb ((s), (wc), (ps))
#endif
#define MBSINIT(s) \
(mb_cur_max == 1 ? 1 : mbsinit ((s)))
#define MBRLEN(s, n, ps) \
(mb_cur_max == 1 ? 1 : mbrtowc (NULL, s, n, ps))
@@ -268,6 +271,7 @@ extern bool is_utf8;
(mb_cur_max == 1 ? 1 : brlen (ch, ps))
#else
#define MBSINIT(s) 1
#define MBRLEN(s, n, ps) 1
#define BRLEN(ch, ps) 1
#endif