aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1998-04-02 22:48:51 +0000
committerRichard M. Stallman1998-04-02 22:48:51 +0000
commit9658795ce8b2423d96f07919cfd44069552f73ab (patch)
treebd89050484ca39cb20c92aef8d4dde79d0c09e22 /src
parent898df4aa14618a21de463e8312cbc7c07f7f4f6d (diff)
downloademacs-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.c14
1 files changed, 6 insertions, 8 deletions
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.")
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}