aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa1997-08-10 04:13:19 +0000
committerKenichi Handa1997-08-10 04:13:19 +0000
commitdec58e65b13945edd1ffaf61d84c092efe517a05 (patch)
treef4d5ab18155835f633ac34d4e7cd76e4a9a8e3b1
parentdf8bf431475c03421fe9ca360031923be101f1c5 (diff)
downloademacs-dec58e65b13945edd1ffaf61d84c092efe517a05.tar.gz
emacs-dec58e65b13945edd1ffaf61d84c092efe517a05.zip
(concat): Pay attention to multibyte characters when
TARGET_TYPE is Lisp_String.
-rw-r--r--src/fns.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/fns.c b/src/fns.c
index 20eb5bbf2a9..8a76dcd1cff 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -410,20 +410,30 @@ concat (nargs, args, target_type, last_special)
410 { 410 {
411 this = args[argnum]; 411 this = args[argnum];
412 len = Flength (this); 412 len = Flength (this);
413 if (VECTORP (this) && target_type == Lisp_String) 413 if ((VECTORP (this) || CONSP (this)) && target_type == Lisp_String)
414
414 { 415 {
415 /* We must pay attention to a multibyte character which 416 /* We must pay attention to a multibyte character which
416 takes more than one byte in string. */ 417 takes more than one byte in string. */
417 int i; 418 int i;
418 Lisp_Object ch; 419 Lisp_Object ch;
419 420
420 for (i = 0; i < XFASTINT (len); i++) 421 if (VECTORP (this))
421 { 422 for (i = 0; i < XFASTINT (len); i++)
422 ch = XVECTOR (this)->contents[i]; 423 {
423 if (! INTEGERP (ch)) 424 ch = XVECTOR (this)->contents[i];
424 wrong_type_argument (Qintegerp, ch); 425 if (! INTEGERP (ch))
425 leni += Fchar_bytes (ch); 426 wrong_type_argument (Qintegerp, ch);
426 } 427 leni += Fchar_bytes (ch);
428 }
429 else
430 for (; CONSP (this); this = XCONS (this)->cdr)
431 {
432 ch = XCONS (this)->car;
433 if (! INTEGERP (ch))
434 wrong_type_argument (Qintegerp, ch);
435 leni += Fchar_bytes (ch);
436 }
427 } 437 }
428 else 438 else
429 leni += XFASTINT (len); 439 leni += XFASTINT (len);