Mercurial > emacs
changeset 21342:efdf4fe4875b
(Fstring_as_multibyte): Never return unibyte string unchanged.
Set size_byte field.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 02 Apr 1998 22:48:51 +0000 |
parents | 3bfdea3ee4af |
children | a3059cd301f1 |
files | src/fns.c |
diffstat | 1 files changed, 6 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/fns.c Thu Apr 02 18:46:08 1998 +0000 +++ b/src/fns.c Thu Apr 02 22:48:51 1998 +0000 @@ -871,14 +871,12 @@ { if (! STRING_MULTIBYTE (string)) { - int newlen = multibyte_chars_in_text (XSTRING (string)->data, - STRING_BYTES (XSTRING (string))); - /* If all the chars are ASCII, STRING is already suitable. */ - if (newlen != STRING_BYTES (XSTRING (string))) - { - string = Fcopy_sequence (string); - XSTRING (string)->size = newlen; - } + int nbytes = STRING_BYTES (XSTRING (string)); + int newlen = multibyte_chars_in_text (XSTRING (string)->data, nbytes); + + string = Fcopy_sequence (string); + XSTRING (string)->size = newlen; + XSTRING (string)->size_byte = nbytes; } return string; }