changeset 89622:96081c0be5ca

(skip_chars): Be sure to alloca char_ranges when necessary.
author Kenichi Handa <handa@m17n.org>
date Sat, 15 Nov 2003 00:59:37 +0000
parents ebf92ac35403
children 4c3976d8d2c3
files src/syntax.c
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/syntax.c	Thu Nov 13 23:35:01 2003 +0000
+++ b/src/syntax.c	Sat Nov 15 00:59:37 2003 +0000
@@ -1418,8 +1418,6 @@
   string_multibyte = SBYTES (string) > SCHARS (string);
 
   bzero (fastmap, sizeof fastmap);
-  if (multibyte)
-    char_ranges = (int *) alloca (SCHARS (string) * (sizeof (int)) * 2);
 
   str = SDATA (string);
   size_byte = SBYTES (string);
@@ -1502,6 +1500,7 @@
 	  fastmap[CHAR_LEADING_CODE (c)] = 1;
 	  range_start_byte = i;
 	  range_start_char = c;
+	  char_ranges = (int *) alloca (sizeof (int) * 128 * 2);
 	  for (i = 129; i < 0400; i++)
 	    {
 	      c = unibyte_char_to_multibyte (i);
@@ -1520,8 +1519,10 @@
 					  + range_start_char);
 	}
     }
-  else
+  else				/* STRING is multibyte */
     {
+      char_ranges = (int *) alloca (sizeof (int) * SCHARS (string) * 2);
+
       while (i_byte < size_byte)
 	{
 	  unsigned char leading_code;
@@ -1564,6 +1565,8 @@
 		  i_byte += len;
 		}
 
+	      if (c > c2)
+		continue;
 	      if (ASCII_CHAR_P (c))
 		{
 		  while (c <= c2 && c < 0x80)