summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2002-09-18 12:14:36 +0000
committerKenichi Handa <handa@m17n.org>2002-09-18 12:14:36 +0000
commitfd09e6cfcf10f9265e4a8fda3327cc90a2efef94 (patch)
tree0dd7583ce8e8afa19060ba4576b5103346ab9562
parent133806f10686a1bebc2c8fd1d431b7f3fc4cdf39 (diff)
downloademacs-fd09e6cfcf10f9265e4a8fda3327cc90a2efef94.tar.gz
(skip_syntaxes): Fix previous change.
-rw-r--r--src/syntax.c55
1 files 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);
+ }
}
}