diff options
| author | Richard M. Stallman | 1998-03-21 18:09:01 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-03-21 18:09:01 +0000 |
| commit | b10b2daa18775dc1bd218ab6c33cae4a3f8447ab (patch) | |
| tree | dbe1683b58eb6ef2340950687912e1f2618e7fc8 /src | |
| parent | 763401461fcf16041fc6b639b1c92635cd118488 (diff) | |
| download | emacs-b10b2daa18775dc1bd218ab6c33cae4a3f8447ab.tar.gz emacs-b10b2daa18775dc1bd218ab6c33cae4a3f8447ab.zip | |
(substring_both, Fsubstring): Use make_specified_string.
(concat): Make string result unibyte or multibyte as appropriate.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fns.c | 14 |
1 files changed, 9 insertions, 5 deletions
| @@ -507,8 +507,10 @@ concat (nargs, args, target_type, last_special) | |||
| 507 | val = Fmake_list (make_number (result_len), Qnil); | 507 | val = Fmake_list (make_number (result_len), Qnil); |
| 508 | else if (target_type == Lisp_Vectorlike) | 508 | else if (target_type == Lisp_Vectorlike) |
| 509 | val = Fmake_vector (make_number (result_len), Qnil); | 509 | val = Fmake_vector (make_number (result_len), Qnil); |
| 510 | else | 510 | else if (some_multibyte) |
| 511 | val = make_uninit_multibyte_string (result_len, result_len_byte); | 511 | val = make_uninit_multibyte_string (result_len, result_len_byte); |
| 512 | else | ||
| 513 | val = make_uninit_string (result_len); | ||
| 512 | 514 | ||
| 513 | /* In `append', if all but last arg are nil, return last arg. */ | 515 | /* In `append', if all but last arg are nil, return last arg. */ |
| 514 | if (target_type == Lisp_Cons && EQ (val, Qnil)) | 516 | if (target_type == Lisp_Cons && EQ (val, Qnil)) |
| @@ -966,8 +968,9 @@ This function allows vectors as well as strings.") | |||
| 966 | 968 | ||
| 967 | if (STRINGP (string)) | 969 | if (STRINGP (string)) |
| 968 | { | 970 | { |
| 969 | res = make_multibyte_string (XSTRING (string)->data + from_byte, | 971 | res = make_specified_string (XSTRING (string)->data + from_byte, |
| 970 | to_char - from_char, to_byte - from_byte); | 972 | to_char - from_char, to_byte - from_byte, |
| 973 | STRING_MULTIBYTE (string)); | ||
| 971 | copy_text_properties (from_char, to_char, string, | 974 | copy_text_properties (from_char, to_char, string, |
| 972 | make_number (0), res, Qnil); | 975 | make_number (0), res, Qnil); |
| 973 | } | 976 | } |
| @@ -1006,8 +1009,9 @@ substring_both (string, from, from_byte, to, to_byte) | |||
| 1006 | 1009 | ||
| 1007 | if (STRINGP (string)) | 1010 | if (STRINGP (string)) |
| 1008 | { | 1011 | { |
| 1009 | res = make_multibyte_string (XSTRING (string)->data + from_byte, | 1012 | res = make_specified_string (XSTRING (string)->data + from_byte, |
| 1010 | to - from, to_byte - from_byte); | 1013 | to - from, to_byte - from_byte, |
| 1014 | STRING_MULTIBYTE (string)); | ||
| 1011 | copy_text_properties (from, to, string, make_number (0), res, Qnil); | 1015 | copy_text_properties (from, to, string, make_number (0), res, Qnil); |
| 1012 | } | 1016 | } |
| 1013 | else | 1017 | else |