Mercurial > emacs
changeset 19278:50f47ef6ce9a
(concat): Pay attention to multibyte characters when
TARGET_TYPE is Lisp_String.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Sun, 10 Aug 1997 04:13:19 +0000 |
parents | 7ea957cd48e2 |
children | 3217a3ba8ef7 |
files | src/fns.c |
diffstat | 1 files changed, 18 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/fns.c Sun Aug 10 04:13:19 1997 +0000 +++ b/src/fns.c Sun Aug 10 04:13:19 1997 +0000 @@ -410,20 +410,30 @@ { 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);