# HG changeset patch # User Kenichi Handa # Date 1031915915 0 # Node ID c4712a200dcb2d8e6165364ae2de283fedbea3f3 # Parent 1365cbd311560453793c59764af012d9f2e6df69 (skip_chars): Fix previous change. (skip_syntaxes): Fix previous change. diff -r 1365cbd31156 -r c4712a200dcb src/syntax.c --- a/src/syntax.c Thu Sep 12 08:37:25 2002 +0000 +++ b/src/syntax.c Fri Sep 13 11:18:35 2002 +0000 @@ -1420,6 +1420,9 @@ if (multibyte) char_ranges = (int *) alloca (XSTRING (string)->size * (sizeof (int)) * 2); + str = XSTRING (string)->data; + size_byte = STRING_BYTES (XSTRING (string)); + i_byte = 0; if (i_byte < size_byte && XSTRING (string)->data[0] == '^') @@ -1433,9 +1436,6 @@ If STRING contains non-ASCII characters, setup char_ranges for them and use fastmap only for their leading codes. */ - str = XSTRING (string)->data; - size_byte = STRING_BYTES (XSTRING (string)); - if (! string_multibyte) { int string_has_eight_bit = 0; @@ -1662,9 +1662,8 @@ } else { - while (pos < XINT (lim) && fastmap[FETCH_BYTE (pos)]) - pos++; - pos_byte = pos; + while (pos < XINT (lim) && fastmap[FETCH_BYTE (pos_byte)]) + pos++, pos_byte++; } } else @@ -1693,9 +1692,8 @@ } else { - while (pos > XINT (lim) && fastmap[FETCH_BYTE (pos - 1)]) - pos--; - pos_byte = pos; + while (pos > XINT (lim) && fastmap[FETCH_BYTE (pos_byte - 1)]) + pos--, pos_byte--; } } @@ -1738,6 +1736,13 @@ bzero (fastmap, sizeof fastmap); + if (STRING_BYTES (XSTRING (string)) > XSTRING (string)->size) + /* As this is very rare case, don't consider efficiency. */ + string = string_make_unibyte (string); + + str = XSTRING (string)->data; + size_byte = STRING_BYTES (XSTRING (string)); + i_byte = 0; if (i_byte < size_byte && XSTRING (string)->data[0] == '^') @@ -1745,12 +1750,6 @@ negate = 1; i_byte++; } - if (STRING_BYTES (XSTRING (string)) > XSTRING (string)->size) - /* As this is very rare case, don't consider efficiency. */ - string = string_make_unibyte (string); - str = XSTRING (string)->data; - size_byte = STRING_BYTES (XSTRING (string)); - /* Find the syntaxes specified and set their elements of fastmap. */ while (i_byte < size_byte) @@ -1791,14 +1790,13 @@ { while (pos < XINT (lim)) { - c = FETCH_BYTE (pos); + c = FETCH_BYTE (pos_byte); MAKE_CHAR_MULTIBYTE (c); if (fastmap[(int) SYNTAX (c)]) break; - pos++; + pos++, pos_byte++; UPDATE_SYNTAX_TABLE_FORWARD (pos); } - pos_byte = pos; } } else @@ -1826,16 +1824,15 @@ if (pos > XINT (lim)) while (1) { - c = FETCH_BYTE (pos - 1); + c = FETCH_BYTE (pos_byte - 1); MAKE_CHAR_MULTIBYTE (c); if (! fastmap[(int) SYNTAX (c)]) break; - pos--; + pos--, pos_byte--; if (pos <= XINT (lim)) break; UPDATE_SYNTAX_TABLE_BACKWARD (pos - 1); } - pos_byte = pos; } }