summaryrefslogtreecommitdiff
path: root/src/regex.c
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2000-06-10 08:04:33 +0000
committerKenichi Handa <handa@m17n.org>2000-06-10 08:04:33 +0000
commitb54f61ed952f1b53a356714cee81136ff23ff8ef (patch)
tree933aba8b3e1d34bc536c019430cdf8fcb1e590b7 /src/regex.c
parentc479bd55eabc3bf77b8b3bb6f54664e33a326c97 (diff)
downloademacs-b54f61ed952f1b53a356714cee81136ff23ff8ef.tar.gz
(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 [...].
Diffstat (limited to 'src/regex.c')
-rw-r--r--src/regex.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/regex.c b/src/regex.c
index df1b0b6d8a9..2e06d0edeaf 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -212,6 +212,7 @@ init_syntax_once ()
#define RE_STRING_CHAR_AND_LENGTH STRING_CHAR_AND_LENGTH
#define GET_CHAR_BEFORE_2(c, p, str1, end1, str2, end2) \
(c = ((p) == (str2) ? *((end1) - 1) : *((p) - 1)))
+#define MAKE_CHAR(charset, c1, c2) (c1)
#endif /* not emacs */
#ifndef RE_TRANSLATE
@@ -2443,18 +2444,23 @@ regex_compile (pattern, size, syntax, bufp)
/* Fetch the character which ends the range. */
PATFETCH (c1);
- if (SINGLE_BYTE_CHAR_P (c)
- && ! SINGLE_BYTE_CHAR_P (c1))
+ if (SINGLE_BYTE_CHAR_P (c))
{
- /* Handle a range such as \177-\377 in multibyte mode.
- Split that into two ranges,,
- the low one ending at 0237, and the high one
- starting at ...040. */
- /* Unless I'm missing something,
- this line is useless. -sm
- int c1_base = (c1 & ~0177) | 040; */
- SET_RANGE_TABLE_WORK_AREA (range_table_work, c, c1);
- c1 = 0237;
+ if (! SINGLE_BYTE_CHAR_P (c1))
+ {
+ /* Handle a range such as \177-\377 in
+ multibyte mode. Split that into two
+ ranges, the low one ending at 0237, and
+ the high one starting at the smallest
+ character in the charset of C1 and
+ ending at C1. */
+ 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))
FREE_STACK_RETURN (REG_ERANGE);