aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2000-06-10 08:04:33 +0000
committerKenichi Handa2000-06-10 08:04:33 +0000
commitb54f61ed952f1b53a356714cee81136ff23ff8ef (patch)
tree933aba8b3e1d34bc536c019430cdf8fcb1e590b7 /src
parentc479bd55eabc3bf77b8b3bb6f54664e33a326c97 (diff)
downloademacs-b54f61ed952f1b53a356714cee81136ff23ff8ef.tar.gz
emacs-b54f61ed952f1b53a356714cee81136ff23ff8ef.zip
(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')
-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 ()
212#define RE_STRING_CHAR_AND_LENGTH STRING_CHAR_AND_LENGTH 212#define RE_STRING_CHAR_AND_LENGTH STRING_CHAR_AND_LENGTH
213#define GET_CHAR_BEFORE_2(c, p, str1, end1, str2, end2) \ 213#define GET_CHAR_BEFORE_2(c, p, str1, end1, str2, end2) \
214 (c = ((p) == (str2) ? *((end1) - 1) : *((p) - 1))) 214 (c = ((p) == (str2) ? *((end1) - 1) : *((p) - 1)))
215#define MAKE_CHAR(charset, c1, c2) (c1)
215#endif /* not emacs */ 216#endif /* not emacs */
216 217
217#ifndef RE_TRANSLATE 218#ifndef RE_TRANSLATE
@@ -2443,18 +2444,23 @@ regex_compile (pattern, size, syntax, bufp)
2443 /* Fetch the character which ends the range. */ 2444 /* Fetch the character which ends the range. */
2444 PATFETCH (c1); 2445 PATFETCH (c1);
2445 2446
2446 if (SINGLE_BYTE_CHAR_P (c) 2447 if (SINGLE_BYTE_CHAR_P (c))
2447 && ! SINGLE_BYTE_CHAR_P (c1))
2448 { 2448 {
2449 /* Handle a range such as \177-\377 in multibyte mode. 2449 if (! SINGLE_BYTE_CHAR_P (c1))
2450 Split that into two ranges,, 2450 {
2451 the low one ending at 0237, and the high one 2451 /* Handle a range such as \177-\377 in
2452 starting at ...040. */ 2452 multibyte mode. Split that into two
2453 /* Unless I'm missing something, 2453 ranges, the low one ending at 0237, and
2454 this line is useless. -sm 2454 the high one starting at the smallest
2455 int c1_base = (c1 & ~0177) | 040; */ 2455 character in the charset of C1 and
2456 SET_RANGE_TABLE_WORK_AREA (range_table_work, c, c1); 2456 ending at C1. */
2457 c1 = 0237; 2457 int charset = CHAR_CHARSET (c1);
2458 int c2 = MAKE_CHAR (charset, 0, 0);
2459
2460 SET_RANGE_TABLE_WORK_AREA (range_table_work,
2461 c2, c1);
2462 c1 = 0237;
2463 }
2458 } 2464 }
2459 else if (!SAME_CHARSET_P (c, c1)) 2465 else if (!SAME_CHARSET_P (c, c1))
2460 FREE_STACK_RETURN (REG_ERANGE); 2466 FREE_STACK_RETURN (REG_ERANGE);