diff options
| author | Richard M. Stallman | 1998-04-02 22:48:51 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-04-02 22:48:51 +0000 |
| commit | 9658795ce8b2423d96f07919cfd44069552f73ab (patch) | |
| tree | bd89050484ca39cb20c92aef8d4dde79d0c09e22 /src | |
| parent | 898df4aa14618a21de463e8312cbc7c07f7f4f6d (diff) | |
| download | emacs-9658795ce8b2423d96f07919cfd44069552f73ab.tar.gz emacs-9658795ce8b2423d96f07919cfd44069552f73ab.zip | |
(Fstring_as_multibyte): Never return unibyte string unchanged.
Set size_byte field.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fns.c | 14 |
1 files changed, 6 insertions, 8 deletions
| @@ -871,14 +871,12 @@ If STRING is multibyte, the result is STRING itself.") | |||
| 871 | { | 871 | { |
| 872 | if (! STRING_MULTIBYTE (string)) | 872 | if (! STRING_MULTIBYTE (string)) |
| 873 | { | 873 | { |
| 874 | int newlen = multibyte_chars_in_text (XSTRING (string)->data, | 874 | int nbytes = STRING_BYTES (XSTRING (string)); |
| 875 | STRING_BYTES (XSTRING (string))); | 875 | int newlen = multibyte_chars_in_text (XSTRING (string)->data, nbytes); |
| 876 | /* If all the chars are ASCII, STRING is already suitable. */ | 876 | |
| 877 | if (newlen != STRING_BYTES (XSTRING (string))) | 877 | string = Fcopy_sequence (string); |
| 878 | { | 878 | XSTRING (string)->size = newlen; |
| 879 | string = Fcopy_sequence (string); | 879 | XSTRING (string)->size_byte = nbytes; |
| 880 | XSTRING (string)->size = newlen; | ||
| 881 | } | ||
| 882 | } | 880 | } |
| 883 | return string; | 881 | return string; |
| 884 | } | 882 | } |