changeset 20814:8f6d92b4f48a

(concat): Handle bool-vectors correctly.
author Richard M. Stallman <rms@gnu.org>
date Mon, 02 Feb 1998 01:06:29 +0000
parents b040da7cfab8
children d5ae7491d2b0
files src/fns.c
diffstat 1 files changed, 34 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/src/fns.c	Mon Feb 02 01:03:10 1998 +0000
+++ b/src/fns.c	Mon Feb 02 01:06:29 1998 +0000
@@ -557,43 +557,47 @@
 	    if (NILP (this)) break;
 	    if (CONSP (this))
 	      elt = XCONS (this)->car, this = XCONS (this)->cdr;
-	    else
+	    else if (thisindex >= thisleni)
+	      break;
+	    else if (STRINGP (this))
 	      {
-		if (thisindex >= thisleni) break;
-		if (STRINGP (this))
+		if (STRING_MULTIBYTE (this))
 		  {
-		    if (STRING_MULTIBYTE (this))
+		    int c;
+		    FETCH_STRING_CHAR_ADVANCE (c, this,
+					       thisindex,
+					       thisindex_byte);
+		    XSETFASTINT (elt, c);
+		  }
+		else
+		  {
+		    unsigned char c;
+		    XSETFASTINT (elt, XSTRING (this)->data[thisindex++]);
+		    if (some_multibyte && XINT (elt) >= 0200
+			&& XINT (elt) < 0400)
 		      {
-			int c;
-			FETCH_STRING_CHAR_ADVANCE (c, this,
-						   thisindex,
-						   thisindex_byte);
-			XSETFASTINT (elt, c);
-		      }
-		    else
-		      {
-			unsigned char c;
-			XSETFASTINT (elt, XSTRING (this)->data[thisindex++]);
-			if (some_multibyte)
-			  XSETINT (elt,
-				   unibyte_char_to_multibyte (XINT (elt)));
+			c = XINT (elt);
+			if (nonascii_insert_offset > 0)
+			  c += nonascii_insert_offset;
+			else
+			  c += DEFAULT_NONASCII_INSERT_OFFSET;
+
+			XSETINT (elt, c);
 		      }
 		  }
-		else if (BOOL_VECTOR_P (this))
-		  {
-		    int size_in_chars
-		      = ((XBOOL_VECTOR (this)->size + BITS_PER_CHAR - 1)
-			 / BITS_PER_CHAR);
-		    int byte;
-		    byte = XBOOL_VECTOR (val)->data[thisindex / BITS_PER_CHAR];
-		    if (byte & (1 << (thisindex % BITS_PER_CHAR)))
-		      elt = Qt;
-		    else
-		      elt = Qnil;
-		  }
+	      }
+	    else if (BOOL_VECTOR_P (this))
+	      {
+		int byte;
+		byte = XBOOL_VECTOR (this)->data[thisindex / BITS_PER_CHAR];
+		if (byte & (1 << (thisindex % BITS_PER_CHAR)))
+		  elt = Qt;
 		else
-		  elt = XVECTOR (this)->contents[thisindex++];
+		  elt = Qnil;
+		thisindex++;
 	      }
+	    else
+	      elt = XVECTOR (this)->contents[thisindex++];
 
 	    /* Store this element into the result.  */
 	    if (toindex < 0)