diff options
author | Richard M. Stallman <rms@gnu.org> | 1998-02-02 01:06:29 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1998-02-02 01:06:29 +0000 |
commit | 0af9c46f8ded26cd8702fe63c07e3d0a2157f2ec (patch) | |
tree | 88e66887cebd15aa27fb68064ace19b28f58ba3a | |
parent | bd129a63ab166329445d8aea5216ab4599763f75 (diff) | |
download | emacs-0af9c46f8ded26cd8702fe63c07e3d0a2157f2ec.tar.gz |
(concat): Handle bool-vectors correctly.
-rw-r--r-- | src/fns.c | 64 |
1 files changed, 34 insertions, 30 deletions
diff --git a/src/fns.c b/src/fns.c index 1f55a8f4262..bb323f765f7 100644 --- a/src/fns.c +++ b/src/fns.c @@ -557,43 +557,47 @@ concat (nargs, args, target_type, last_special) 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) - XSETINT (elt, - unibyte_char_to_multibyte (XINT (elt))); - } + int c; + FETCH_STRING_CHAR_ADVANCE (c, this, + thisindex, + thisindex_byte); + XSETFASTINT (elt, c); } - else if (BOOL_VECTOR_P (this)) + else { - 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; + unsigned char c; + XSETFASTINT (elt, XSTRING (this)->data[thisindex++]); + if (some_multibyte && XINT (elt) >= 0200 + && XINT (elt) < 0400) + { + 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 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) |