]> git.eshelyaron.com Git - emacs.git/commitdiff
(concat): Pay attention to multibyte characters when
authorKenichi Handa <handa@m17n.org>
Sun, 10 Aug 1997 04:13:19 +0000 (04:13 +0000)
committerKenichi Handa <handa@m17n.org>
Sun, 10 Aug 1997 04:13:19 +0000 (04:13 +0000)
TARGET_TYPE is Lisp_String.

src/fns.c

index 20eb5bbf2a9435bc1ef54eb0c5b67a10bae64fbb..8a76dcd1cff6ff1f55ebf472230aa54698f682a8 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -410,20 +410,30 @@ concat (nargs, args, target_type, last_special)
     {
       this = args[argnum];
       len = Flength (this);
-      if (VECTORP (this) && target_type == Lisp_String)
+      if ((VECTORP (this) || CONSP (this)) && target_type == Lisp_String)
+
        {
          /* We must pay attention to a multibyte character which
              takes more than one byte in string.  */
          int i;
          Lisp_Object ch;
 
-         for (i = 0; i < XFASTINT (len); i++)
-           {
-             ch = XVECTOR (this)->contents[i];
-             if (! INTEGERP (ch))
-               wrong_type_argument (Qintegerp, ch);
-             leni += Fchar_bytes (ch);
-           }
+         if (VECTORP (this))
+           for (i = 0; i < XFASTINT (len); i++)
+             {
+               ch = XVECTOR (this)->contents[i];
+               if (! INTEGERP (ch))
+                 wrong_type_argument (Qintegerp, ch);
+               leni += Fchar_bytes (ch);
+             }
+         else
+           for (; CONSP (this); this = XCONS (this)->cdr)
+             {
+               ch = XCONS (this)->car;
+               if (! INTEGERP (ch))
+                 wrong_type_argument (Qintegerp, ch);
+               leni += Fchar_bytes (ch);
+             }
        }
       else
        leni += XFASTINT (len);