Mercurial > hg > octave-lyh > gnulib-hg
changeset 3917:075b873e1ca3 EMACS_21_1_RC
(GET_CHAR_BEFORE_2): Fix for the case that the previous
char is eight-bit-graphic.
(re_search_2): Likewise.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Thu, 16 Jan 2003 01:44:22 +0000 |
parents | c218b50ede10 |
children | |
files | regex.c |
diffstat | 1 files changed, 14 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/regex.c +++ b/regex.c @@ -156,8 +156,12 @@ { \ re_char *dtemp = (p) == (str2) ? (end1) : (p); \ re_char *dlimit = ((p) > (str2) && (p) <= (end2)) ? (str2) : (str1); \ + re_char *d0 = dtemp; \ while (dtemp-- > dlimit && !CHAR_HEAD_P (*dtemp)); \ - c = STRING_CHAR (dtemp, (p) - dtemp); \ + if (MULTIBYTE_FORM_LENGTH (dtemp, d0 - dtemp) == d0 - dtemp) \ + c = STRING_CHAR (dtemp, d0 - dtemp); \ + else \ + c = d0[-1]; \ } \ else \ (c = ((p) == (str2) ? (end1) : (p))[-1]); \ @@ -4046,18 +4050,16 @@ p--, len++; /* Adjust it. */ -#if 0 /* XXX */ if (MULTIBYTE_FORM_LENGTH (p, len + 1) != (len + 1)) - ; - else -#endif - { - range += len; - if (range > 0) - break; - - startpos -= len; - } + /* The previous character is eight-bit-graphic which + is represented by one byte even in a multibyte + buffer/string. */ + len = 0; + range += len; + if (range > 0) + break; + + startpos -= len; } } }