changeset 21260:4ac9ba6e745d

(substring_both, Fsubstring): Use make_specified_string. (concat): Make string result unibyte or multibyte as appropriate.
author Richard M. Stallman <rms@gnu.org>
date Sat, 21 Mar 1998 18:09:01 +0000
parents 3abae7d11d07
children edaef0e79ff0
files src/fns.c
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/fns.c	Sat Mar 21 18:07:27 1998 +0000
+++ b/src/fns.c	Sat Mar 21 18:09:01 1998 +0000
@@ -507,8 +507,10 @@
     val = Fmake_list (make_number (result_len), Qnil);
   else if (target_type == Lisp_Vectorlike)
     val = Fmake_vector (make_number (result_len), Qnil);
+  else if (some_multibyte)
+    val = make_uninit_multibyte_string (result_len, result_len_byte);
   else
-    val = make_uninit_multibyte_string (result_len, result_len_byte);
+    val = make_uninit_string (result_len);
 
   /* In `append', if all but last arg are nil, return last arg.  */
   if (target_type == Lisp_Cons && EQ (val, Qnil))
@@ -966,8 +968,9 @@
 
   if (STRINGP (string))
     {
-      res = make_multibyte_string (XSTRING (string)->data + from_byte,
-				   to_char - from_char, to_byte - from_byte);
+      res = make_specified_string (XSTRING (string)->data + from_byte,
+				   to_char - from_char, to_byte - from_byte,
+				   STRING_MULTIBYTE (string));
       copy_text_properties (from_char, to_char, string,
 			    make_number (0), res, Qnil);
     }
@@ -1006,8 +1009,9 @@
 
   if (STRINGP (string))
     {
-      res = make_multibyte_string (XSTRING (string)->data + from_byte,
-				   to - from, to_byte - from_byte);
+      res = make_specified_string (XSTRING (string)->data + from_byte,
+				   to - from, to_byte - from_byte,
+				   STRING_MULTIBYTE (string));
       copy_text_properties (from, to, string, make_number (0), res, Qnil);
     }
   else