comparison src/fns.c @ 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 475cf041a683
children ca0fca5eb8c9
comparison
equal deleted inserted replaced
19277:7ea957cd48e2 19278:50f47ef6ce9a
408 408
409 for (argnum = 0, leni = 0; argnum < nargs; argnum++) 409 for (argnum = 0, leni = 0; argnum < nargs; argnum++)
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);
430 } 440 }
431 441