From: Richard M. Stallman Date: Thu, 2 Apr 1998 22:48:51 +0000 (+0000) Subject: (Fstring_as_multibyte): Never return unibyte string unchanged. X-Git-Tag: emacs-20.3~1732 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9658795ce8b2423d96f07919cfd44069552f73ab;p=emacs.git (Fstring_as_multibyte): Never return unibyte string unchanged. Set size_byte field. --- diff --git a/src/fns.c b/src/fns.c index 6d30c09c45b..c98cb2547b8 100644 --- a/src/fns.c +++ b/src/fns.c @@ -871,14 +871,12 @@ If STRING is multibyte, the result is STRING itself.") { 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; }