Commit b54f61ed authored by Kenichi Handa's avatar Kenichi Handa
Browse files

(MAKE_CHAR) [!emacs]: Dummy macro for non-Emacs env.

(regex_compile): Fix the code for handling the case of single byte
char and multibyte char being mixed in a range within [...].
parent c479bd55
...@@ -212,6 +212,7 @@ init_syntax_once () ...@@ -212,6 +212,7 @@ init_syntax_once ()
#define RE_STRING_CHAR_AND_LENGTH STRING_CHAR_AND_LENGTH #define RE_STRING_CHAR_AND_LENGTH STRING_CHAR_AND_LENGTH
#define GET_CHAR_BEFORE_2(c, p, str1, end1, str2, end2) \ #define GET_CHAR_BEFORE_2(c, p, str1, end1, str2, end2) \
(c = ((p) == (str2) ? *((end1) - 1) : *((p) - 1))) (c = ((p) == (str2) ? *((end1) - 1) : *((p) - 1)))
#define MAKE_CHAR(charset, c1, c2) (c1)
#endif /* not emacs */ #endif /* not emacs */
#ifndef RE_TRANSLATE #ifndef RE_TRANSLATE
...@@ -2443,18 +2444,23 @@ regex_compile (pattern, size, syntax, bufp) ...@@ -2443,18 +2444,23 @@ regex_compile (pattern, size, syntax, bufp)
/* Fetch the character which ends the range. */ /* Fetch the character which ends the range. */
PATFETCH (c1); PATFETCH (c1);
if (SINGLE_BYTE_CHAR_P (c) if (SINGLE_BYTE_CHAR_P (c))
&& ! SINGLE_BYTE_CHAR_P (c1))
{ {
/* Handle a range such as \177-\377 in multibyte mode. if (! SINGLE_BYTE_CHAR_P (c1))
Split that into two ranges,, {
the low one ending at 0237, and the high one /* Handle a range such as \177-\377 in
starting at ...040. */ multibyte mode. Split that into two
/* Unless I'm missing something, ranges, the low one ending at 0237, and
this line is useless. -sm the high one starting at the smallest
int c1_base = (c1 & ~0177) | 040; */ character in the charset of C1 and
SET_RANGE_TABLE_WORK_AREA (range_table_work, c, c1); ending at C1. */
c1 = 0237; int charset = CHAR_CHARSET (c1);
int c2 = MAKE_CHAR (charset, 0, 0);
SET_RANGE_TABLE_WORK_AREA (range_table_work,
c2, c1);
c1 = 0237;
}
} }
else if (!SAME_CHARSET_P (c, c1)) else if (!SAME_CHARSET_P (c, c1))
FREE_STACK_RETURN (REG_ERANGE); FREE_STACK_RETURN (REG_ERANGE);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment