changeset 106185:f2cea199b0c4

* character.h (STRING_CHAR, STRING_CHAR_AND_LENGTH): Remove ignored second argument. All callers changed. * regex.c (STRING_CHAR, STRING_CHAR_AND_LENGTH, RE_STRING_CHAR) (RE_STRING_CHAR_AND_LENGTH): Likewise. * xdisp.c (string_char_and_length): Likewise.
author Andreas Schwab <schwab@linux-m68k.org>
date Sat, 21 Nov 2009 11:52:23 +0000
parents 0579465d2619
children 9b6f45dd8386
files src/ChangeLog src/buffer.c src/buffer.h src/casefiddle.c src/character.c src/character.h src/composite.c src/data.c src/doc.c src/editfns.c src/fileio.c src/fns.c src/font.c src/indent.c src/insdel.c src/lread.c src/print.c src/process.c src/regex.c src/search.c src/syntax.c src/xdisp.c src/xterm.c
diffstat 23 files changed, 107 insertions(+), 125 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sat Nov 21 10:32:20 2009 +0000
+++ b/src/ChangeLog	Sat Nov 21 11:52:23 2009 +0000
@@ -1,3 +1,11 @@
+2009-11-21  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* character.h (STRING_CHAR, STRING_CHAR_AND_LENGTH): Remove
+	ignored second argument.  All callers changed.
+	* regex.c (STRING_CHAR, STRING_CHAR_AND_LENGTH, RE_STRING_CHAR)
+	(RE_STRING_CHAR_AND_LENGTH): Likewise.
+	* xdisp.c (string_char_and_length): Likewise.
+
 2009-11-21  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* xterm.c (x_new_font):
--- a/src/buffer.c	Sat Nov 21 10:32:20 2009 +0000
+++ b/src/buffer.c	Sat Nov 21 11:52:23 2009 +0000
@@ -2409,7 +2409,7 @@
 	    p++, pos++;
 	  else if (CHAR_BYTE8_HEAD_P (*p))
 	    {
-	      c = STRING_CHAR_AND_LENGTH (p, stop - pos, bytes);
+	      c = STRING_CHAR_AND_LENGTH (p, bytes);
 	      /* Delete all bytes for this 8-bit character but the
 		 last one, and change the last one to the charcter
 		 code.  */
--- a/src/buffer.h	Sat Nov 21 10:32:20 2009 +0000
+++ b/src/buffer.h	Sat Nov 21 11:52:23 2009 +0000
@@ -330,7 +330,7 @@
 #define FETCH_MULTIBYTE_CHAR(pos)				 	\
   (_fetch_multibyte_char_p = (((pos) >= GPT_BYTE ? GAP_SIZE : 0) 	\
 			       + (pos) + BEG_ADDR - BEG_BYTE),	 	\
-   STRING_CHAR (_fetch_multibyte_char_p, 0))
+   STRING_CHAR (_fetch_multibyte_char_p))
 
 /* Return character at position POS.  If the current buffer is unibyte
    and the character is not ASCII, make the returning character
@@ -389,7 +389,7 @@
   (_fetch_multibyte_char_p						\
      = (((pos) >= BUF_GPT_BYTE (buf) ? BUF_GAP_SIZE (buf) : 0)		\
         + (pos) + BUF_BEG_ADDR (buf) - BEG_BYTE),			\
-   STRING_CHAR (_fetch_multibyte_char_p, 0))
+   STRING_CHAR (_fetch_multibyte_char_p))
 
 /* Define the actual buffer data structures.  */
 
--- a/src/casefiddle.c	Sat Nov 21 10:32:20 2009 +0000
+++ b/src/casefiddle.c	Sat Nov 21 11:52:23 2009 +0000
@@ -133,7 +133,7 @@
 	      bcopy (old_dst, dst, o - old_dst);
 	      o = dst + (o - old_dst);
 	    }
-	  c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i_byte, 0, len);
+	  c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i_byte, len);
 	  if (inword && flag != CASE_CAPITALIZE_UP)
 	    c = DOWNCASE (c);
 	  else if (!UPPERCASEP (c)
--- a/src/character.c	Sat Nov 21 10:32:20 2009 +0000
+++ b/src/character.c	Sat Nov 21 11:52:23 2009 +0000
@@ -405,7 +405,7 @@
     {
       int bytes, thiswidth;
       Lisp_Object val;
-      int c = STRING_CHAR_AND_LENGTH (str + i_byte, len - i_byte, bytes);
+      int c = STRING_CHAR_AND_LENGTH (str + i_byte, bytes);
 
       if (dp)
 	{
@@ -495,7 +495,7 @@
 	  int c;
 
 	  if (multibyte)
-	    c = STRING_CHAR_AND_LENGTH (str + i_byte, len - i_byte, bytes);
+	    c = STRING_CHAR_AND_LENGTH (str + i_byte, bytes);
 	  else
 	    c = str[i_byte], bytes = 1;
 	  chars = 1;
@@ -1061,7 +1061,7 @@
       if (! STRING_MULTIBYTE (string))
 	return make_number (*p);
     }
-  c = STRING_CHAR (p, 0);
+  c = STRING_CHAR (p);
   if (CHAR_BYTE8_P (c))
     c = CHAR_TO_BYTE8 (c);
   else if (! ASCII_CHAR_P (c))
--- a/src/character.h	Sat Nov 21 10:32:20 2009 +0000
+++ b/src/character.h	Sat Nov 21 11:52:23 2009 +0000
@@ -311,10 +311,9 @@
   } while (0)
 
 /* Return the character code of character whose multibyte form is at
-   P.  The argument LEN is ignored.  It will be removed in the
-   future.  */
+   P.  */
 
-#define STRING_CHAR(p, len)					\
+#define STRING_CHAR(p)						\
   (!((p)[0] & 0x80)						\
    ? (p)[0]							\
    : ! ((p)[0] & 0x20)						\
@@ -329,10 +328,9 @@
 
 
 /* Like STRING_CHAR, but set ACTUAL_LEN to the length of multibyte
-   form.  The argument LEN is ignored.  It will be removed in the
-   future.  */
+   form.  */
 
-#define STRING_CHAR_AND_LENGTH(p, len, actual_len)		\
+#define STRING_CHAR_AND_LENGTH(p, actual_len)			\
   (!((p)[0] & 0x80)						\
    ? ((actual_len) = 1, (p)[0])					\
    : ! ((p)[0] & 0x20)						\
@@ -382,7 +380,7 @@
 	  unsigned char *ptr = &SDATA (STRING)[BYTEIDX];		\
 	  int len;							\
 									\
-	  OUTPUT = STRING_CHAR_AND_LENGTH (ptr, 0, len);		\
+	  OUTPUT = STRING_CHAR_AND_LENGTH (ptr, len);			\
 	  BYTEIDX += len;						\
 	}								\
       else								\
@@ -405,7 +403,7 @@
 	  unsigned char *ptr = &SDATA (STRING)[BYTEIDX];		      \
 	  int len;							      \
 									      \
-	  OUTPUT = STRING_CHAR_AND_LENGTH (ptr, 0, len);		      \
+	  OUTPUT = STRING_CHAR_AND_LENGTH (ptr, len);			      \
 	  BYTEIDX += len;						      \
 	}								      \
       else								      \
@@ -426,7 +424,7 @@
       unsigned char *ptr = &SDATA (STRING)[BYTEIDX];			     \
       int len;								     \
 									     \
-      OUTPUT = STRING_CHAR_AND_LENGTH (ptr, 0, len);			     \
+      OUTPUT = STRING_CHAR_AND_LENGTH (ptr, len);			     \
       BYTEIDX += len;							     \
       CHARIDX++;							     \
     }									     \
@@ -445,7 +443,7 @@
 	  unsigned char *ptr = BYTE_POS_ADDR (BYTEIDX);		\
 	  int len;						\
 								\
-	  OUTPUT= STRING_CHAR_AND_LENGTH (ptr, 0, len);		\
+	  OUTPUT= STRING_CHAR_AND_LENGTH (ptr, len);		\
 	  BYTEIDX += len;					\
 	}							\
       else							\
@@ -465,7 +463,7 @@
       unsigned char *ptr = BYTE_POS_ADDR (BYTEIDX);		\
       int len;							\
 								\
-      OUTPUT= STRING_CHAR_AND_LENGTH (ptr, 0, len);		\
+      OUTPUT = STRING_CHAR_AND_LENGTH (ptr, len);		\
       BYTEIDX += len;						\
       CHARIDX++;						\
     }								\
--- a/src/composite.c	Sat Nov 21 10:32:20 2009 +0000
+++ b/src/composite.c	Sat Nov 21 11:52:23 2009 +0000
@@ -1321,7 +1321,7 @@
  retry:
   check_val = Qnil;
   /* At first, check if POS is composable.  */
-  c = STRING_CHAR (cur.p, 0);
+  c = STRING_CHAR (cur.p);
   if (! CHAR_COMPOSABLE_P (c))
     {
       if (limit < 0)
@@ -1347,7 +1347,7 @@
 		fore_check_limit = cur.pos;
 		break;
 	      }
-	    c = STRING_CHAR (cur.p, 0);
+	    c = STRING_CHAR (cur.p);
 	    if (! CHAR_COMPOSABLE_P (c))
 	      break;
 	    val = CHAR_TABLE_REF (Vcomposition_function_table, c);
@@ -1368,7 +1368,7 @@
       if (get_property_and_range (cur.pos, Qcomposition, &val, &b, &e, Qnil)
 	  && COMPOSITION_VALID_P (b, e, val))
 	break;
-      c = STRING_CHAR (cur.p, 0);
+      c = STRING_CHAR (cur.p);
       if (! CHAR_COMPOSABLE_P (c))
 	break;
       val = CHAR_TABLE_REF (Vcomposition_function_table, c);
@@ -1391,7 +1391,7 @@
 
 	  if (NILP (check_val))
 	    {
-	      c = STRING_CHAR (cur.p, 0);
+	      c = STRING_CHAR (cur.p);
 	      check_val = CHAR_TABLE_REF (Vcomposition_function_table, c);
 	    }
 	  for (; CONSP (check_val); check_val = XCDR (check_val))
--- a/src/data.c	Sat Nov 21 10:32:20 2009 +0000
+++ b/src/data.c	Sat Nov 21 11:52:23 2009 +0000
@@ -2007,8 +2007,7 @@
 	return make_number ((unsigned char) SREF (array, idxval));
       idxval_byte = string_char_to_byte (array, idxval);
 
-      c = STRING_CHAR (SDATA (array) + idxval_byte,
-		       SBYTES (array) - idxval_byte);
+      c = STRING_CHAR (SDATA (array) + idxval_byte);
       return make_number (c);
     }
   else if (BOOL_VECTOR_P (array))
--- a/src/doc.c	Sat Nov 21 10:32:20 2009 +0000
+++ b/src/doc.c	Sat Nov 21 11:52:23 2009 +0000
@@ -767,9 +767,8 @@
 	  if (multibyte)
 	    {
 	      int len;
-	      int maxlen = SDATA (string) + SBYTES (string) - strp;
 
-	      STRING_CHAR_AND_LENGTH (strp, maxlen, len);
+	      STRING_CHAR_AND_LENGTH (strp, len);
 	      if (len == 1)
 		*bufp = *strp;
 	      else
@@ -931,9 +930,8 @@
       else
 	{
 	  int len;
-	  int maxlen = SDATA (string) + SBYTES (string) - strp;
 
-	  STRING_CHAR_AND_LENGTH (strp, maxlen, len);
+	  STRING_CHAR_AND_LENGTH (strp, len);
 	  if (len == 1)
 	    *bufp = *strp;
 	  else
--- a/src/editfns.c	Sat Nov 21 10:32:20 2009 +0000
+++ b/src/editfns.c	Sat Nov 21 11:52:23 2009 +0000
@@ -231,7 +231,7 @@
   if (SCHARS (string))
     {
       if (STRING_MULTIBYTE (string))
-	XSETFASTINT (val, STRING_CHAR (SDATA (string), SBYTES (string)));
+	XSETFASTINT (val, STRING_CHAR (SDATA (string)));
       else
 	XSETFASTINT (val, SREF (string, 0));
     }
@@ -2983,7 +2983,7 @@
 		      memcpy (newbuf, buf, sizeof (int) * buf_used);
 		      buf = newbuf;
 		    }
-		  buf[buf_used++] = STRING_CHAR_AND_LENGTH (p, 0, len);
+		  buf[buf_used++] = STRING_CHAR_AND_LENGTH (p, len);
 		  pos_byte += len;
 		}
 	      if (XINT (AREF (elt, i)) != buf[i])
@@ -3052,7 +3052,7 @@
       Lisp_Object val;
 
       if (multibyte)
-	oc = STRING_CHAR_AND_LENGTH (p, MAX_MULTIBYTE_LENGTH, len);
+	oc = STRING_CHAR_AND_LENGTH (p, len);
       else
 	oc = *p, len = 1;
       if (oc < size)
@@ -3064,8 +3064,7 @@
 	      if (string_multibyte)
 		{
 		  str = tt + string_char_to_byte (table, oc);
-		  nc = STRING_CHAR_AND_LENGTH (str, MAX_MULTIBYTE_LENGTH,
-					       str_len);
+		  nc = STRING_CHAR_AND_LENGTH (str, str_len);
 		}
 	      else
 		{
--- a/src/fileio.c	Sat Nov 21 10:32:20 2009 +0000
+++ b/src/fileio.c	Sat Nov 21 11:52:23 2009 +0000
@@ -277,7 +277,7 @@
 	    int c;
 
 	    str = (char *) SDATA (errstring);
-	    c = STRING_CHAR (str, 0);
+	    c = STRING_CHAR (str);
 	    Faset (errstring, make_number (0), make_number (DOWNCASE (c)));
 	  }
 
--- a/src/fns.c	Sat Nov 21 10:32:20 2009 +0000
+++ b/src/fns.c	Sat Nov 21 11:52:23 2009 +0000
@@ -1711,8 +1711,7 @@
 	{
 	  if (STRING_MULTIBYTE (seq))
 	    {
-	      c = STRING_CHAR (SDATA (seq) + ibyte,
-			       SBYTES (seq) - ibyte);
+	      c = STRING_CHAR (SDATA (seq) + ibyte);
 	      cbytes = CHAR_BYTES (c);
 	    }
 	  else
@@ -1742,8 +1741,7 @@
 	    {
 	      if (STRING_MULTIBYTE (seq))
 		{
-		  c = STRING_CHAR (SDATA (seq) + ibyte,
-				   SBYTES (seq) - ibyte);
+		  c = STRING_CHAR (SDATA (seq) + ibyte);
 		  cbytes = CHAR_BYTES (c);
 		}
 	      else
@@ -3363,7 +3361,7 @@
     {
       if (multibyte)
 	{
-	  c = STRING_CHAR_AND_LENGTH (from + i, length - i, bytes);
+	  c = STRING_CHAR_AND_LENGTH (from + i, bytes);
 	  if (CHAR_BYTE8_P (c))
 	    c = CHAR_TO_BYTE8 (c);
 	  else if (c >= 256)
@@ -3403,7 +3401,7 @@
 
       if (multibyte)
 	{
-	  c = STRING_CHAR_AND_LENGTH (from + i, length - i, bytes);
+	  c = STRING_CHAR_AND_LENGTH (from + i, bytes);
 	  if (CHAR_BYTE8_P (c))
 	    c = CHAR_TO_BYTE8 (c);
 	  else if (c >= 256)
@@ -3427,7 +3425,7 @@
 
       if (multibyte)
 	{
-	  c = STRING_CHAR_AND_LENGTH (from + i, length - i, bytes);
+	  c = STRING_CHAR_AND_LENGTH (from + i, bytes);
 	  if (CHAR_BYTE8_P (c))
 	    c = CHAR_TO_BYTE8 (c);
 	  else if (c >= 256)
--- a/src/font.c	Sat Nov 21 10:32:20 2009 +0000
+++ b/src/font.c	Sat Nov 21 11:52:23 2009 +0000
@@ -3863,7 +3863,7 @@
 	      EMACS_INT pos_byte = string_char_to_byte (string, pos);
 
 	      str = SDATA (string) + pos_byte;
-	      c = STRING_CHAR (str, 0);
+	      c = STRING_CHAR (str);
 	    }
 	  else
 	    c = SDATA (string)[pos];
--- a/src/indent.c	Sat Nov 21 10:32:20 2009 +0000
+++ b/src/indent.c	Sat Nov 21 11:52:23 2009 +0000
@@ -295,7 +295,7 @@
     int c;								\
     									\
     wide_column = 0;							\
-    c = STRING_CHAR_AND_LENGTH (p, MAX_MULTIBYTE_LENGTH, bytes);	\
+    c = STRING_CHAR_AND_LENGTH (p, bytes);				\
     if (BYTES_BY_CHAR_HEAD (*p) != bytes)				\
       width = bytes * 4;						\
     else								\
--- a/src/insdel.c	Sat Nov 21 10:32:20 2009 +0000
+++ b/src/insdel.c	Sat Nov 21 11:52:23 2009 +0000
@@ -648,7 +648,7 @@
       while (bytes_left > 0)
 	{
 	  int thislen, c;
-	  c = STRING_CHAR_AND_LENGTH (from_addr, bytes_left, thislen);
+	  c = STRING_CHAR_AND_LENGTH (from_addr, thislen);
 	  if (! ASCII_CHAR_P (c))
 	    c &= 0xFF;
 	  *to_addr++ = c;
--- a/src/lread.c	Sat Nov 21 10:32:20 2009 +0000
+++ b/src/lread.c	Sat Nov 21 11:52:23 2009 +0000
@@ -303,7 +303,7 @@
 	  /* Fetch the character code from the buffer.  */
 	  unsigned char *p = BUF_BYTE_ADDRESS (inbuffer, pt_byte);
 	  BUF_INC_POS (inbuffer, pt_byte);
-	  c = STRING_CHAR (p, pt_byte - orig_pt_byte);
+	  c = STRING_CHAR (p);
 	  if (multibyte)
 	    *multibyte = 1;
 	}
@@ -332,7 +332,7 @@
 	  /* Fetch the character code from the buffer.  */
 	  unsigned char *p = BUF_BYTE_ADDRESS (inbuffer, bytepos);
 	  BUF_INC_POS (inbuffer, bytepos);
-	  c = STRING_CHAR (p, bytepos - orig_bytepos);
+	  c = STRING_CHAR (p);
 	  if (multibyte)
 	    *multibyte = 1;
 	}
@@ -439,7 +439,7 @@
 	}
       buf[i++] = c;
     }
-  return STRING_CHAR (buf, i);
+  return STRING_CHAR (buf);
 }
 
 /* Unread the character C in the way appropriate for the stream READCHARFUN.
--- a/src/print.c	Sat Nov 21 10:32:20 2009 +0000
+++ b/src/print.c	Sat Nov 21 11:52:23 2009 +0000
@@ -401,7 +401,7 @@
 	  int len;
 	  for (i = 0; i < size_byte; i += len)
 	    {
-	      int ch = STRING_CHAR_AND_LENGTH (ptr + i, size_byte - i, len);
+	      int ch = STRING_CHAR_AND_LENGTH (ptr + i, len);
 	      insert_char (ch);
 	    }
 	}
@@ -427,7 +427,7 @@
 		 corresponding character code before handing it to
 		 PRINTCHAR.  */
 	      int len;
-	      int ch = STRING_CHAR_AND_LENGTH (ptr + i, size_byte - i, len);
+	      int ch = STRING_CHAR_AND_LENGTH (ptr + i, len);
 	      PRINTCHAR (ch);
 	      i += len;
 	    }
@@ -519,8 +519,7 @@
 	    /* Here, we must convert each multi-byte form to the
 	       corresponding character code before handing it to PRINTCHAR.  */
 	    int len;
-	    int ch = STRING_CHAR_AND_LENGTH (SDATA (string) + i,
-					     size_byte - i, len);
+	    int ch = STRING_CHAR_AND_LENGTH (SDATA (string) + i, len);
 	    PRINTCHAR (ch);
 	    i += len;
 	  }
@@ -1645,8 +1644,7 @@
 
 	      if (multibyte)
 		{
-		  c = STRING_CHAR_AND_LENGTH (str + i_byte,
-					      size_byte - i_byte, len);
+		  c = STRING_CHAR_AND_LENGTH (str + i_byte, len);
 		  i_byte += len;
 		}
 	      else
--- a/src/process.c	Sat Nov 21 10:32:20 2009 +0000
+++ b/src/process.c	Sat Nov 21 11:52:23 2009 +0000
@@ -477,7 +477,7 @@
 	  if (! NILP (Vlocale_coding_system))
 	    string = (code_convert_string_norecord
 		      (string, Vlocale_coding_system, 0));
-	  c1 = STRING_CHAR ((char *) SDATA (string), 0);
+	  c1 = STRING_CHAR ((char *) SDATA (string));
 	  c2 = DOWNCASE (c1);
 	  if (c1 != c2)
 	    Faset (string, make_number (0), make_number (c2));
--- a/src/regex.c	Sat Nov 21 10:32:20 2009 +0000
+++ b/src/regex.c	Sat Nov 21 11:52:23 2009 +0000
@@ -147,10 +147,10 @@
 
 # define RE_MULTIBYTE_P(bufp) ((bufp)->multibyte)
 # define RE_TARGET_MULTIBYTE_P(bufp) ((bufp)->target_multibyte)
-# define RE_STRING_CHAR(p, s, multibyte) \
-  (multibyte ? (STRING_CHAR (p, s)) : (*(p)))
-# define RE_STRING_CHAR_AND_LENGTH(p, s, len, multibyte) \
-  (multibyte ? (STRING_CHAR_AND_LENGTH (p, s, len)) : ((len) = 1, *(p)))
+# define RE_STRING_CHAR(p, multibyte) \
+  (multibyte ? (STRING_CHAR (p)) : (*(p)))
+# define RE_STRING_CHAR_AND_LENGTH(p, len, multibyte) \
+  (multibyte ? (STRING_CHAR_AND_LENGTH (p, len)) : ((len) = 1, *(p)))
 
 # define RE_CHAR_TO_MULTIBYTE(c) UNIBYTE_TO_CHAR (c)
 
@@ -166,7 +166,7 @@
 	re_char *dtemp = (p) == (str2) ? (end1) : (p);			     \
 	re_char *dlimit = ((p) > (str2) && (p) <= (end2)) ? (str2) : (str1); \
 	while (dtemp-- > dlimit && !CHAR_HEAD_P (*dtemp));		     \
-	c = STRING_CHAR (dtemp, (p) - dtemp);				     \
+	c = STRING_CHAR (dtemp);					     \
       }									     \
     else								     \
       {									     \
@@ -180,7 +180,7 @@
 # define GET_CHAR_AFTER(c, p, len)		\
   do {						\
     if (target_multibyte)			\
-      (c) = STRING_CHAR_AND_LENGTH (p, 0, len);	\
+      (c) = STRING_CHAR_AND_LENGTH (p, len);	\
     else					\
       {						\
 	(c) = *p;				\
@@ -302,11 +302,11 @@
 # define SAME_CHARSET_P(c1, c2) (1)
 # define MULTIBYTE_FORM_LENGTH(p, s) (1)
 # define PREV_CHAR_BOUNDARY(p, limit) ((p)--)
-# define STRING_CHAR(p, s) (*(p))
-# define RE_STRING_CHAR(p, s, multibyte) STRING_CHAR ((p), (s))
+# define STRING_CHAR(p) (*(p))
+# define RE_STRING_CHAR(p, multibyte) STRING_CHAR (p)
 # define CHAR_STRING(c, s) (*(s) = (c), 1)
-# define STRING_CHAR_AND_LENGTH(p, s, actual_len) ((actual_len) = 1, *(p))
-# define RE_STRING_CHAR_AND_LENGTH(p, s, len, multibyte) STRING_CHAR_AND_LENGTH ((p), (s), (len))
+# define STRING_CHAR_AND_LENGTH(p, actual_len) ((actual_len) = 1, *(p))
+# define RE_STRING_CHAR_AND_LENGTH(p, len, multibyte) STRING_CHAR_AND_LENGTH (p, len)
 # define RE_CHAR_TO_MULTIBYTE(c) (c)
 # define RE_CHAR_TO_UNIBYTE(c) (c)
 # define GET_CHAR_BEFORE_2(c, p, str1, end1, str2, end2) \
@@ -1757,7 +1757,7 @@
   do {									\
     int len;								\
     if (p == pend) return REG_EEND;					\
-    c = RE_STRING_CHAR_AND_LENGTH (p, pend - p, len, multibyte);	\
+    c = RE_STRING_CHAR_AND_LENGTH (p, len, multibyte);			\
     p += len;								\
   } while (0)
 
@@ -4541,8 +4541,7 @@
 		      {
 			int buf_charlen;
 
-			buf_ch = STRING_CHAR_AND_LENGTH (d, range - lim,
-							 buf_charlen);
+			buf_ch = STRING_CHAR_AND_LENGTH (d, buf_charlen);
 			buf_ch = RE_TRANSLATE (translate, buf_ch);
 			if (fastmap[CHAR_LEADING_CODE (buf_ch)])
 			  break;
@@ -4574,8 +4573,7 @@
 		      {
 			int buf_charlen;
 
-			buf_ch = STRING_CHAR_AND_LENGTH (d, range - lim,
-							 buf_charlen);
+			buf_ch = STRING_CHAR_AND_LENGTH (d, buf_charlen);
 			if (fastmap[CHAR_LEADING_CODE (buf_ch)])
 			  break;
 			range -= buf_charlen;
@@ -4592,12 +4590,9 @@
 	    }
 	  else				/* Searching backwards.  */
 	    {
-	      int room = (startpos >= size1
-			  ? size2 + size1 - startpos
-			  : size1 - startpos);
 	      if (multibyte)
 		{
-		  buf_ch = STRING_CHAR (d, room);
+		  buf_ch = STRING_CHAR (d);
 		  buf_ch = TRANSLATE (buf_ch);
 		  if (! fastmap[CHAR_LEADING_CODE (buf_ch)])
 		    goto advance;
@@ -4888,11 +4883,11 @@
       {
 	register re_wchar_t c
 	  = (re_opcode_t) *p2 == endline ? '\n'
-	  : RE_STRING_CHAR (p2 + 2, pend - p2 - 2, multibyte);
+	  : RE_STRING_CHAR (p2 + 2, multibyte);
 
 	if ((re_opcode_t) *p1 == exactn)
 	  {
-	    if (c != RE_STRING_CHAR (p1 + 2, pend - p1 - 2, multibyte))
+	    if (c != RE_STRING_CHAR (p1 + 2, multibyte))
 	      {
 		DEBUG_PRINT3 ("  '%c' != '%c' => fast loop.\n", c, p1[2]);
 		return 1;
@@ -5543,13 +5538,13 @@
 
 		PREFETCH ();
 		if (multibyte)
-		  pat_ch = STRING_CHAR_AND_LENGTH (p, pend - p, pat_charlen);
+		  pat_ch = STRING_CHAR_AND_LENGTH (p, pat_charlen);
 		else
 		  {
 		    pat_ch = RE_CHAR_TO_MULTIBYTE (*p);
 		    pat_charlen = 1;
 		  }
-		buf_ch = STRING_CHAR_AND_LENGTH (d, dend - d, buf_charlen);
+		buf_ch = STRING_CHAR_AND_LENGTH (d, buf_charlen);
 
 		if (TRANSLATE (buf_ch) != pat_ch)
 		  {
@@ -5571,7 +5566,7 @@
 		PREFETCH ();
 		if (multibyte)
 		  {
-		    pat_ch = STRING_CHAR_AND_LENGTH (p, pend - p, pat_charlen);
+		    pat_ch = STRING_CHAR_AND_LENGTH (p, pat_charlen);
 		    pat_ch = RE_CHAR_TO_UNIBYTE (pat_ch);
 		  }
 		else
@@ -5611,7 +5606,7 @@
 	    DEBUG_PRINT1 ("EXECUTING anychar.\n");
 
 	    PREFETCH ();
-	    buf_ch = RE_STRING_CHAR_AND_LENGTH (d, dend - d, buf_charlen,
+	    buf_ch = RE_STRING_CHAR_AND_LENGTH (d, buf_charlen,
 						target_multibyte);
 	    buf_ch = TRANSLATE (buf_ch);
 
@@ -5659,7 +5654,7 @@
 	      }
 
 	    PREFETCH ();
-	    c = RE_STRING_CHAR_AND_LENGTH (d, dend - d, len, target_multibyte);
+	    c = RE_STRING_CHAR_AND_LENGTH (d, len, target_multibyte);
 	    if (target_multibyte)
 	      {
 		int c1;
@@ -6257,7 +6252,7 @@
 	      UPDATE_SYNTAX_TABLE (charpos);
 #endif
 	      PREFETCH ();
-	      c2 = RE_STRING_CHAR (d, dend - d, target_multibyte);
+	      c2 = RE_STRING_CHAR (d, target_multibyte);
 	      s2 = SYNTAX (c2);
 
 	      /* Case 2: S2 is neither Sword nor Ssymbol. */
@@ -6310,7 +6305,7 @@
 	      if (!AT_STRINGS_END (d))
 		{
 		  PREFETCH_NOLIMIT ();
-		  c2 = RE_STRING_CHAR (d, dend - d, target_multibyte);
+		  c2 = RE_STRING_CHAR (d, target_multibyte);
 #ifdef emacs
 		  UPDATE_SYNTAX_TABLE_FORWARD (charpos + 1);
 #endif
--- a/src/search.c	Sat Nov 21 10:32:20 2009 +0000
+++ b/src/search.c	Sat Nov 21 11:52:23 2009 +0000
@@ -1387,7 +1387,7 @@
 		  base_pat++;
 		}
 
-	      c = STRING_CHAR_AND_LENGTH (base_pat, len_byte, in_charlen);
+	      c = STRING_CHAR_AND_LENGTH (base_pat, in_charlen);
 
 	      if (NILP (trt))
 		{
@@ -1527,7 +1527,6 @@
 	    EMACS_INT this_pos = pos;
 	    EMACS_INT this_pos_byte = pos_byte;
 	    int this_len = len;
-	    int this_len_byte = len_byte;
 	    unsigned char *p = pat;
 	    if (pos + len > lim || pos_byte + len_byte > lim_byte)
 	      goto stop;
@@ -1537,16 +1536,14 @@
 		int charlen, buf_charlen;
 		int pat_ch, buf_ch;
 
-		pat_ch = STRING_CHAR_AND_LENGTH (p, this_len_byte, charlen);
+		pat_ch = STRING_CHAR_AND_LENGTH (p, charlen);
 		buf_ch = STRING_CHAR_AND_LENGTH (BYTE_POS_ADDR (this_pos_byte),
-						 ZV_BYTE - this_pos_byte,
 						 buf_charlen);
 		TRANSLATE (buf_ch, trt, buf_ch);
 
 		if (buf_ch != pat_ch)
 		  break;
 
-		this_len_byte -= charlen;
 		this_len--;
 		p += charlen;
 
@@ -1615,7 +1612,6 @@
 	    EMACS_INT this_pos = pos - len;
 	    EMACS_INT this_pos_byte;
 	    int this_len = len;
-	    int this_len_byte = len_byte;
 	    unsigned char *p = pat;
 
 	    if (this_pos < lim || (pos_byte - len_byte) < lim_byte)
@@ -1628,16 +1624,14 @@
 		int charlen, buf_charlen;
 		int pat_ch, buf_ch;
 
-		pat_ch = STRING_CHAR_AND_LENGTH (p, this_len_byte, charlen);
+		pat_ch = STRING_CHAR_AND_LENGTH (p, charlen);
 		buf_ch = STRING_CHAR_AND_LENGTH (BYTE_POS_ADDR (this_pos_byte),
-						 ZV_BYTE - this_pos_byte,
 						 buf_charlen);
 		TRANSLATE (buf_ch, trt, buf_ch);
 
 		if (buf_ch != pat_ch)
 		  break;
 
-		this_len_byte -= charlen;
 		this_len--;
 		p += charlen;
 		this_pos_byte += buf_charlen;
@@ -1841,7 +1835,7 @@
 
 	      while (! (CHAR_HEAD_P (*charstart)))
 		charstart--;
-	      ch = STRING_CHAR (charstart, ptr - charstart + 1);
+	      ch = STRING_CHAR (charstart);
 	      if (char_base != (ch & ~0x3F))
 		ch = -1;
 	    }
--- a/src/syntax.c	Sat Nov 21 10:32:20 2009 +0000
+++ b/src/syntax.c	Sat Nov 21 11:52:23 2009 +0000
@@ -911,8 +911,7 @@
   if (*p)
     {
       int len;
-      int character = (STRING_CHAR_AND_LENGTH
-		       (p, SBYTES (string) - 1, len));
+      int character = STRING_CHAR_AND_LENGTH (p, len);
       XSETINT (match, character);
       if (XFASTINT (match) == ' ')
 	match = Qnil;
@@ -1588,12 +1587,12 @@
 	  unsigned char leading_code;
 
 	  leading_code = str[i_byte];
-	  c = STRING_CHAR_AND_LENGTH (str + i_byte, size_byte-i_byte, len);
+	  c = STRING_CHAR_AND_LENGTH (str + i_byte, len);
 	  i_byte += len;
 
 	  if (handle_iso_classes && c == '['
 	      && i_byte < size_byte
-	      && STRING_CHAR (str + i_byte, size_byte - i_byte) == ':')
+	      && STRING_CHAR (str + i_byte) == ':')
 	    {
 	      const unsigned char *class_beg = str + i_byte + 1;
 	      const unsigned char *class_end = class_beg;
@@ -1633,8 +1632,7 @@
 		break;
 
 	      leading_code = str[i_byte];
-	      c = STRING_CHAR_AND_LENGTH (str + i_byte,
-					  size_byte - i_byte, len);
+	      c = STRING_CHAR_AND_LENGTH (str + i_byte, len);
 	      i_byte += len;
 	    }
 	  /* Treat `-' as range character only if another character
@@ -1650,15 +1648,14 @@
 
 	      /* Get the end of the range.  */
 	      leading_code2 = str[i_byte];
-	      c2 = STRING_CHAR_AND_LENGTH (str + i_byte,
-					   size_byte - i_byte, len);
+	      c2 = STRING_CHAR_AND_LENGTH (str + i_byte, len);
 	      i_byte += len;
 
 	      if (c2 == '\\'
 		  && i_byte < size_byte)
 		{
 		  leading_code2 = str[i_byte];
-		  c2 =STRING_CHAR_AND_LENGTH (str + i_byte, size_byte-i_byte, len);
+		  c2 =STRING_CHAR_AND_LENGTH (str + i_byte, len);
 		  i_byte += len;
 		}
 
@@ -1764,7 +1761,7 @@
 		  p = GAP_END_ADDR;
 		  stop = endp;
 		}
-	      c = STRING_CHAR_AND_LENGTH (p, MAX_MULTIBYTE_LENGTH, nbytes);
+	      c = STRING_CHAR_AND_LENGTH (p, nbytes);
 	      if (! NILP (iso_classes) && in_classes (c, iso_classes))
 		{
 		  if (negate)
@@ -1835,7 +1832,7 @@
 		}
 	      prev_p = p;
 	      while (--p >= stop && ! CHAR_HEAD_P (*p));
-	      c = STRING_CHAR (p, MAX_MULTIBYTE_LENGTH);
+	      c = STRING_CHAR (p);
 
 	      if (! NILP (iso_classes) && in_classes (c, iso_classes))
 		{
@@ -1989,7 +1986,7 @@
 		    p = GAP_END_ADDR;
 		    stop = endp;
 		  }
-		c = STRING_CHAR_AND_LENGTH (p, MAX_MULTIBYTE_LENGTH, nbytes);
+		c = STRING_CHAR_AND_LENGTH (p, nbytes);
 		if (! fastmap[(int) SYNTAX (c)])
 		  break;
 		p += nbytes, pos++, pos_byte += nbytes;
@@ -2032,7 +2029,7 @@
 		UPDATE_SYNTAX_TABLE_BACKWARD (pos - 1);
 		prev_p = p;
 		while (--p >= stop && ! CHAR_HEAD_P (*p));
-		c = STRING_CHAR (p, MAX_MULTIBYTE_LENGTH);
+		c = STRING_CHAR (p);
 		if (! fastmap[(int) SYNTAX (c)])
 		  break;
 		pos--, pos_byte -= prev_p - p;
--- a/src/xdisp.c	Sat Nov 21 10:32:20 2009 +0000
+++ b/src/xdisp.c	Sat Nov 21 11:52:23 2009 +0000
@@ -919,7 +919,7 @@
 static int display_echo_area_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT));
 static int resize_mini_window_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT));
 static Lisp_Object unwind_redisplay P_ ((Lisp_Object));
-static int string_char_and_length P_ ((const unsigned char *, int, int *));
+static int string_char_and_length P_ ((const unsigned char *, int *));
 static struct text_pos display_prop_end P_ ((struct it *, Lisp_Object,
 					     struct text_pos));
 static int compute_window_start_on_continuation_line P_ ((struct window *));
@@ -1485,13 +1485,13 @@
    character.  */
 
 static INLINE int
-string_char_and_length (str, maxlen, len)
+string_char_and_length (str, len)
      const unsigned char *str;
-     int maxlen, *len;
+     int *len;
 {
   int c;
 
-  c = STRING_CHAR_AND_LENGTH (str, maxlen, *len);
+  c = STRING_CHAR_AND_LENGTH (str, *len);
   if (!CHAR_VALID_P (c, 1))
     /* We may not change the length here because other places in Emacs
        don't use this function, i.e. they silently accept invalid
@@ -1522,7 +1522,7 @@
 
       while (nchars--)
 	{
-	  string_char_and_length (p, rest, &len);
+	  string_char_and_length (p, &len);
 	  p += len, rest -= len;
 	  xassert (rest >= 0);
 	  CHARPOS (pos) += 1;
@@ -1574,7 +1574,7 @@
       SET_TEXT_POS (pos, 0, 0);
       while (charpos--)
 	{
-	  string_char_and_length (s, rest, &len);
+	  string_char_and_length (s, &len);
 	  s += len, rest -= len;
 	  xassert (rest >= 0);
 	  CHARPOS (pos) += 1;
@@ -1605,7 +1605,7 @@
 
       for (nchars = 0; rest > 0; ++nchars)
 	{
-	  string_char_and_length (p, rest, &len);
+	  string_char_and_length (p, &len);
 	  rest -= len, p += len;
 	}
     }
@@ -3648,7 +3648,7 @@
 	  int c, len;
 	  struct face *face = FACE_FROM_ID (it->f, face_id);
 
-	  c = string_char_and_length (p, rest, &len);
+	  c = string_char_and_length (p, &len);
 	  face_id = FACE_FOR_CHAR (it->f, face, c, CHARPOS (pos), it->string);
 	}
     }
@@ -4650,7 +4650,7 @@
       pos_byte = IT_STRING_BYTEPOS (*it);
       string = it->string;
       s = SDATA (string) + pos_byte;
-      it->c = STRING_CHAR (s, 0);
+      it->c = STRING_CHAR (s);
     }
   else
     {
@@ -6312,7 +6312,7 @@
 	  int remaining = SBYTES (it->string) - IT_STRING_BYTEPOS (*it);
 	  const unsigned char *s = (SDATA (it->string)
 				    + IT_STRING_BYTEPOS (*it));
-	  it->c = string_char_and_length (s, remaining, &it->len);
+	  it->c = string_char_and_length (s, &it->len);
 	}
       else
 	{
@@ -6348,7 +6348,7 @@
 	  int maxlen = SBYTES (it->string) - IT_STRING_BYTEPOS (*it);
 	  const unsigned char *s = (SDATA (it->string)
 				    + IT_STRING_BYTEPOS (*it));
-	  it->c = string_char_and_length (s, maxlen, &it->len);
+	  it->c = string_char_and_length (s, &it->len);
 	}
       else
 	{
@@ -6404,8 +6404,7 @@
 	 performance problem because there is no noticeable performance
 	 difference between Emacs running in unibyte or multibyte mode.  */
       int maxlen = strlen (it->s) - IT_BYTEPOS (*it);
-      it->c = string_char_and_length (it->s + IT_BYTEPOS (*it),
-				      maxlen, &it->len);
+      it->c = string_char_and_length (it->s + IT_BYTEPOS (*it), &it->len);
     }
   else
     it->c = it->s[IT_BYTEPOS (*it)], it->len = 1;
@@ -6535,7 +6534,7 @@
       /* Get the next character, maybe multibyte.  */
       p = BYTE_POS_ADDR (IT_BYTEPOS (*it));
       if (it->multibyte_p && !ASCII_BYTE_P (*p))
-	it->c = STRING_CHAR_AND_LENGTH (p, 0, it->len);
+	it->c = STRING_CHAR_AND_LENGTH (p, it->len);
       else
 	it->c = *p, it->len = 1;
 
@@ -7756,7 +7755,7 @@
 	     for the *Message* buffer.  */
 	  for (i = 0; i < nbytes; i += char_bytes)
 	    {
-	      c = string_char_and_length (m + i, nbytes - i, &char_bytes);
+	      c = string_char_and_length (m + i, &char_bytes);
 	      work[0] = (ASCII_CHAR_P (c)
 			 ? c
 			 : multibyte_char_to_unibyte (c, Qnil));
@@ -9061,7 +9060,7 @@
 	  /* Convert a multibyte string to single-byte.  */
 	  for (i = 0; i < nbytes; i += n)
 	    {
-	      c = string_char_and_length (s + i, nbytes - i, &n);
+	      c = string_char_and_length (s + i, &n);
 	      work[0] = (ASCII_CHAR_P (c)
 			 ? c
 			 : multibyte_char_to_unibyte (c, Qnil));
@@ -15903,7 +15902,7 @@
 
       /* Get the next character.  */
       if (multibyte_p)
-	it.c = string_char_and_length (p, arrow_len, &it.len);
+	it.c = string_char_and_length (p, &it.len);
       else
 	it.c = *p, it.len = 1;
       p += it.len;
@@ -20930,7 +20929,7 @@
 	{
 	  int maxlen = ((IT_BYTEPOS (*it) >= GPT ? ZV : GPT)
 			- IT_BYTEPOS (*it));
-	  it2.c = STRING_CHAR_AND_LENGTH (p, maxlen, it2.len);
+	  it2.c = STRING_CHAR_AND_LENGTH (p, it2.len);
 	}
       else
 	it2.c = *p, it2.len = 1;
--- a/src/xterm.c	Sat Nov 21 10:32:20 2009 +0000
+++ b/src/xterm.c	Sat Nov 21 11:52:23 2009 +0000
@@ -6578,8 +6578,7 @@
 		if (nchars == nbytes)
 		  c = copy_bufptr[i], len = 1;
 		else
-		  c = STRING_CHAR_AND_LENGTH (copy_bufptr + i,
-					      nbytes - i, len);
+		  c = STRING_CHAR_AND_LENGTH (copy_bufptr + i, len);
 		inev.ie.kind = (SINGLE_BYTE_CHAR_P (c)
 				? ASCII_KEYSTROKE_EVENT
 				: MULTIBYTE_CHAR_KEYSTROKE_EVENT);