comparison src/alloc.c @ 33623:dda5cbf94928

(make_string): Fix previous change. Be sure to make unibyte string correctly.
author Kenichi Handa <handa@m17n.org>
date Mon, 20 Nov 2000 01:06:33 +0000
parents 416924b6f303
children a832bb73de79
comparison
equal deleted inserted replaced
33622:c5e53e9b44af 33623:dda5cbf94928
1699 { 1699 {
1700 register Lisp_Object val; 1700 register Lisp_Object val;
1701 int nchars, multibyte_nbytes; 1701 int nchars, multibyte_nbytes;
1702 1702
1703 parse_str_as_multibyte (contents, nbytes, &nchars, &multibyte_nbytes); 1703 parse_str_as_multibyte (contents, nbytes, &nchars, &multibyte_nbytes);
1704 val = make_uninit_multibyte_string (nchars, nbytes);
1705 bcopy (contents, XSTRING (val)->data, nbytes);
1706 if (nbytes == nchars || nbytes != multibyte_nbytes) 1704 if (nbytes == nchars || nbytes != multibyte_nbytes)
1707 /* CONTENTS contains no multibyte sequences or contains an invalid 1705 /* CONTENTS contains no multibyte sequences or contains an invalid
1708 multibyte sequence. We must make unibyte string. */ 1706 multibyte sequence. We must make unibyte string. */
1709 SET_STRING_BYTES (XSTRING (val), -1); 1707 val = make_unibyte_string (contents, nbytes);
1708 else
1709 val = make_multibyte_string (contents, nchars, nbytes);
1710 return val; 1710 return val;
1711 } 1711 }
1712 1712
1713 1713
1714 /* Make an unibyte string from LENGTH bytes at CONTENTS. */ 1714 /* Make an unibyte string from LENGTH bytes at CONTENTS. */