From 8c6e735bfb70b777db18b9f05c40ed1e0f479fee Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Wed, 18 Sep 2002 12:14:36 +0000 Subject: [PATCH] (skip_syntaxes): Fix previous change. --- src/syntax.c | 55 ++++++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/src/syntax.c b/src/syntax.c index e16d8bc45ec..de0ef9078cf 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -1731,6 +1731,9 @@ skip_syntaxes (forwardp, string, lim) if (XINT (lim) < BEGV) XSETFASTINT (lim, BEGV); + if (forward ? PT >= XFASTINT (lim) : PT <= XFASTINT (lim)) + return 0; + multibyte = (!NILP (current_buffer->enable_multibyte_characters) && (lim - PT != CHAR_TO_BYTE (lim) - PT_BYTE)); @@ -1774,27 +1777,28 @@ skip_syntaxes (forwardp, string, lim) { if (multibyte) { - if (pos < XINT (lim)) - while (fastmap[(int) SYNTAX (FETCH_CHAR (pos_byte))]) - { - /* Since we already checked for multibyteness, - avoid using INC_BOTH which checks again. */ - INC_POS (pos_byte); - pos++; - if (pos >= XINT (lim)) - break; - UPDATE_SYNTAX_TABLE_FORWARD (pos); - } + while (fastmap[(int) SYNTAX (FETCH_CHAR (pos_byte))]) + { + /* Since we already checked for multibyteness, + avoid using INC_BOTH which checks again. */ + INC_POS (pos_byte); + pos++; + if (pos >= XINT (lim)) + break; + UPDATE_SYNTAX_TABLE_FORWARD (pos); + } } else { - while (pos < XINT (lim)) + while (1) { c = FETCH_BYTE (pos_byte); MAKE_CHAR_MULTIBYTE (c); if (! fastmap[(int) SYNTAX (c)]) break; pos++, pos_byte++; + if (pos >= XINT (lim)) + break; UPDATE_SYNTAX_TABLE_FORWARD (pos); } } @@ -1803,13 +1807,15 @@ skip_syntaxes (forwardp, string, lim) { if (multibyte) { - while (pos > XINT (lim)) + while (1) { int savepos = pos_byte; /* Since we already checked for multibyteness, avoid using DEC_BOTH which checks again. */ pos--; DEC_POS (pos_byte); + if (pos <= XINT (lim)) + break; UPDATE_SYNTAX_TABLE_BACKWARD (pos); if (!fastmap[(int) SYNTAX (FETCH_CHAR (pos_byte))]) { @@ -1821,18 +1827,17 @@ skip_syntaxes (forwardp, string, lim) } else { - if (pos > XINT (lim)) - while (1) - { - c = FETCH_BYTE (pos_byte - 1); - MAKE_CHAR_MULTIBYTE (c); - if (! fastmap[(int) SYNTAX (c)]) - break; - pos--, pos_byte--; - if (pos <= XINT (lim)) - break; - UPDATE_SYNTAX_TABLE_BACKWARD (pos - 1); - } + while (1) + { + c = FETCH_BYTE (pos_byte - 1); + MAKE_CHAR_MULTIBYTE (c); + if (! fastmap[(int) SYNTAX (c)]) + break; + pos--, pos_byte--; + if (pos <= XINT (lim)) + break; + UPDATE_SYNTAX_TABLE_BACKWARD (pos - 1); + } } } -- 2.39.5