changeset 50632:bd83590b911a

(Faset): Calculate nbytes earlier, to satisfy the now pickier PARSE_MULTIBYTE_SEQ.
author Miles Bader <miles@gnu.org>
date Fri, 18 Apr 2003 01:23:23 +0000
parents 763258a2d395
children 956b2eed924d
files src/data.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/data.c	Thu Apr 17 22:27:13 2003 +0000
+++ b/src/data.c	Fri Apr 18 01:23:23 2003 +0000
@@ -2029,13 +2029,15 @@
     }
   else if (STRING_MULTIBYTE (array))
     {
-      int idxval_byte, prev_bytes, new_bytes;
+      int idxval_byte, prev_bytes, new_bytes, nbytes;
       unsigned char workbuf[MAX_MULTIBYTE_LENGTH], *p0 = workbuf, *p1;
 
       if (idxval < 0 || idxval >= SCHARS (array))
 	args_out_of_range (array, idx);
       CHECK_NUMBER (newelt);
 
+      nbytes = SBYTES (array);
+
       idxval_byte = string_char_to_byte (array, idxval);
       p1 = SDATA (array) + idxval_byte;
       PARSE_MULTIBYTE_SEQ (p1, nbytes - idxval_byte, prev_bytes);
@@ -2044,7 +2046,6 @@
 	{
 	  /* We must relocate the string data.  */
 	  int nchars = SCHARS (array);
-	  int nbytes = SBYTES (array);
 	  unsigned char *str;
 
 	  str = (nbytes <= MAX_ALLOCA