changeset 89113:326caaedbfef

(skip_syntaxes): Fix previous change.
author Kenichi Handa <handa@m17n.org>
date Wed, 18 Sep 2002 12:14:36 +0000
parents d9a45a01f9fc
children 099689a1feb6
files src/syntax.c
diffstat 1 files changed, 30 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/src/syntax.c	Wed Sep 18 11:59:36 2002 +0000
+++ b/src/syntax.c	Wed Sep 18 12:14:36 2002 +0000
@@ -1731,6 +1731,9 @@
   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 @@
       {
 	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 @@
       {
 	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 @@
 	  }
 	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);
+	      }
 	  }
       }