From ba5e343cadd7ea40cb5508f8823f3872161d3110 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Mon, 7 Oct 2002 12:59:21 +0000 Subject: [PATCH] (re_search_2): Fix for the case of unibyte buffer. --- src/ChangeLog | 7 +++++++ src/regex.c | 25 +++++++++++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 47b7f90359b..4b9400ab77d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2002-10-07 Kenichi Handa + + * keymap.c (push_key_description): Pay attention to + force_multibyte. + + * regex.c (re_search_2): Fix for the case of unibyte buffer. + 2002-10-06 Dave Love * charset.c (define_charset_internal): Rename `supprementary'. diff --git a/src/regex.c b/src/regex.c index a7ded877515..8cbc5f7949a 100644 --- a/src/regex.c +++ b/src/regex.c @@ -4099,13 +4099,26 @@ re_search_2 (bufp, str1, size1, str2, size2, startpos, range, regs, stop) int room = (startpos >= size1 ? size2 + size1 - startpos : size1 - startpos); - buf_ch = RE_STRING_CHAR (d, room); - if (! target_multibyte) - MAKE_CHAR_MULTIBYTE (buf_ch); - buf_ch = TRANSLATE (buf_ch); - if (! fastmap[CHAR_LEADING_CODE (buf_ch)]) - goto advance; + if (multibyte) + { + /* Case of Emacs. */ + if (target_multibyte) + buf_ch = RE_STRING_CHAR (d, room); + else + { + buf_ch = *d; + MAKE_CHAR_MULTIBYTE (buf_ch); + } + buf_ch = TRANSLATE (buf_ch); + if (! fastmap[CHAR_LEADING_CODE (buf_ch)]) + goto advance; + } + else + { + if (! fastmap[TRANSLATE (*d)]) + goto advance; + } } } -- 2.39.2