comparison src/alloc.c @ 50200:fdeb795fc0ec

(make_specified_string): Fix previous change.
author Kenichi Handa <handa@m17n.org>
date Wed, 19 Mar 2003 12:24:43 +0000
parents d9ade23e09df
children a617ca0d5d85
comparison
equal deleted inserted replaced
50199:2e56eaaf925b 50200:fdeb795fc0ec
1817 } 1817 }
1818 1818
1819 1819
1820 /* Make a string from NCHARS characters occupying NBYTES bytes at 1820 /* Make a string from NCHARS characters occupying NBYTES bytes at
1821 CONTENTS. The argument MULTIBYTE controls whether to label the 1821 CONTENTS. The argument MULTIBYTE controls whether to label the
1822 string as multibyte. */ 1822 string as multibyte. If NCHARS is negative, it counts the number of
1823 characters by itself. */
1823 1824
1824 Lisp_Object 1825 Lisp_Object
1825 make_specified_string (contents, nchars, nbytes, multibyte) 1826 make_specified_string (contents, nchars, nbytes, multibyte)
1826 char *contents; 1827 char *contents;
1827 int nchars, nbytes; 1828 int nchars, nbytes;
1828 int multibyte; 1829 int multibyte;
1829 { 1830 {
1830 register Lisp_Object val; 1831 register Lisp_Object val;
1832
1833 if (nchars < 0)
1834 {
1835 if (multibyte)
1836 nchars = multibyte_chars_in_text (contents, nbytes);
1837 else
1838 nchars = nbytes;
1839 }
1831 val = make_uninit_multibyte_string (nchars, nbytes); 1840 val = make_uninit_multibyte_string (nchars, nbytes);
1832 bcopy (contents, SDATA (val), nbytes); 1841 bcopy (contents, SDATA (val), nbytes);
1833 if (!multibyte) 1842 if (!multibyte)
1834 STRING_SET_UNIBYTE (val); 1843 STRING_SET_UNIBYTE (val);
1835 return val; 1844 return val;