Commit 9658795c authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(Fstring_as_multibyte): Never return unibyte string unchanged.

Set size_byte field.
parent 898df4aa
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment