aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1998-03-21 18:05:29 +0000
committerRichard M. Stallman1998-03-21 18:05:29 +0000
commit5f75e6660f4f633c2c8640dd3973ff57bf2be26a (patch)
tree1613edfe1151e2e9016c09433cf55478c1896e55 /src
parent7d3d343a93233bb8980990482dbee822681dcc63 (diff)
downloademacs-5f75e6660f4f633c2c8640dd3973ff57bf2be26a.tar.gz
emacs-5f75e6660f4f633c2c8640dd3973ff57bf2be26a.zip
(Fchar_to_string): Use make_string_from_bytes.
(Fformat): Use make_specified_string. (make_buffer_string_both): Use make_uninit_string if buffer is unibyte.
Diffstat (limited to 'src')
-rw-r--r--src/editfns.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/editfns.c b/src/editfns.c
index 74aa8971f62..d1e17fcc092 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -122,7 +122,7 @@ init_editfns ()
122} 122}
123 123
124DEFUN ("char-to-string", Fchar_to_string, Schar_to_string, 1, 1, 0, 124DEFUN ("char-to-string", Fchar_to_string, Schar_to_string, 1, 1, 0,
125 "Convert arg CHAR to a string containing multi-byte form of that character.") 125 "Convert arg CHAR to a string containing that character.")
126 (character) 126 (character)
127 Lisp_Object character; 127 Lisp_Object character;
128{ 128{
@@ -132,7 +132,7 @@ DEFUN ("char-to-string", Fchar_to_string, Schar_to_string, 1, 1, 0,
132 CHECK_NUMBER (character, 0); 132 CHECK_NUMBER (character, 0);
133 133
134 len = CHAR_STRING (XFASTINT (character), workbuf, str); 134 len = CHAR_STRING (XFASTINT (character), workbuf, str);
135 return make_multibyte_string (str, 1, len); 135 return make_string_from_bytes (str, 1, len);
136} 136}
137 137
138DEFUN ("string-to-char", Fstring_to_char, Sstring_to_char, 1, 1, 0, 138DEFUN ("string-to-char", Fstring_to_char, Sstring_to_char, 1, 1, 0,
@@ -1476,7 +1476,10 @@ make_buffer_string_both (start, start_byte, end, end_byte, props)
1476 if (start < GPT && GPT < end) 1476 if (start < GPT && GPT < end)
1477 move_gap (start); 1477 move_gap (start);
1478 1478
1479 result = make_uninit_multibyte_string (end - start, end_byte - start_byte); 1479 if (! NILP (current_buffer->enable_multibyte_characters))
1480 result = make_uninit_multibyte_string (end - start, end_byte - start_byte);
1481 else
1482 result = make_uninit_string (end - start);
1480 bcopy (BYTE_POS_ADDR (start_byte), XSTRING (result)->data, 1483 bcopy (BYTE_POS_ADDR (start_byte), XSTRING (result)->data,
1481 end_byte - start_byte); 1484 end_byte - start_byte);
1482 1485
@@ -2491,7 +2494,7 @@ Use %% to put a single % into the output.")
2491 *p++ = *format++, nchars++; 2494 *p++ = *format++, nchars++;
2492 } 2495 }
2493 2496
2494 val = make_multibyte_string (buf, nchars, p - buf); 2497 val = make_specified_string (buf, nchars, p - buf, multibyte);
2495 2498
2496 /* If we allocated BUF with malloc, free it too. */ 2499 /* If we allocated BUF with malloc, free it too. */
2497 if (total >= 1000) 2500 if (total >= 1000)