From 229b28c432a6df8b02b8f6cb492ffd1bedb8db5c Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Wed, 19 Mar 2003 12:24:43 +0000 Subject: [PATCH] (make_specified_string): Fix previous change. --- src/alloc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/alloc.c b/src/alloc.c index d703d3d99b2..2c1d09ac43e 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -1819,7 +1819,8 @@ make_string_from_bytes (contents, nchars, nbytes) /* Make a string from NCHARS characters occupying NBYTES bytes at CONTENTS. The argument MULTIBYTE controls whether to label the - string as multibyte. */ + string as multibyte. If NCHARS is negative, it counts the number of + characters by itself. */ Lisp_Object make_specified_string (contents, nchars, nbytes, multibyte) @@ -1828,6 +1829,14 @@ make_specified_string (contents, nchars, nbytes, multibyte) int multibyte; { register Lisp_Object val; + + if (nchars < 0) + { + if (multibyte) + nchars = multibyte_chars_in_text (contents, nbytes); + else + nchars = nbytes; + } val = make_uninit_multibyte_string (nchars, nbytes); bcopy (contents, SDATA (val), nbytes); if (!multibyte) -- 2.11.4.GIT