aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2004-04-28 12:44:04 +0000
committerKenichi Handa2004-04-28 12:44:04 +0000
commit6ad568ddc1672bdc393fec62430712e40a654aff (patch)
tree8ad3cd44cc1a8edd13cca57eb486a303db20c9c0 /src
parent1345675f1ff5e341b2ff8b9fa85e27cb4e99ab73 (diff)
downloademacs-6ad568ddc1672bdc393fec62430712e40a654aff.tar.gz
emacs-6ad568ddc1672bdc393fec62430712e40a654aff.zip
(e_write): Short cut for the case of no encoding.
Diffstat (limited to 'src')
-rw-r--r--src/fileio.c39
1 files changed, 31 insertions, 8 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 17be7bf4d9c..d20e3eecf89 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5362,18 +5362,41 @@ e_write (desc, string, start, end, coding)
5362 do 5362 do
5363 { 5363 {
5364 if (STRINGP (string)) 5364 if (STRINGP (string))
5365 encode_coding_object (coding, string, 5365 {
5366 start, string_char_to_byte (string, start), 5366 coding->src_multibyte = SCHARS (string) < SBYTES (string);
5367 end, string_char_to_byte (string, end), Qt); 5367 if (CODING_REQUIRE_ENCODING (coding))
5368 encode_coding_object (coding, string,
5369 start, string_char_to_byte (string, start),
5370 end, string_char_to_byte (string, end), Qt);
5371 else
5372 coding->dst_object = string, coding->produced = SBYTES (string);
5373 }
5368 else 5374 else
5369 encode_coding_object (coding, Fcurrent_buffer (), 5375 {
5370 start, CHAR_TO_BYTE (start), 5376 int start_byte = CHAR_TO_BYTE (start);
5371 end, CHAR_TO_BYTE (end), Qt); 5377 int end_byte = CHAR_TO_BYTE (end);
5378
5379 coding->src_multibyte = (end - start) < (end_byte - start_byte);
5380 if (CODING_REQUIRE_ENCODING (coding))
5381 encode_coding_object (coding, Fcurrent_buffer (),
5382 start, CHAR_TO_BYTE (start),
5383 end, CHAR_TO_BYTE (end), Qt);
5384 else
5385 {
5386 coding->dst_object = Qnil;
5387 coding->produced = end - start;
5388 coding->dst_pos_byte = start_byte;
5389 }
5390 }
5372 5391
5373 if (coding->produced > 0) 5392 if (coding->produced > 0)
5374 { 5393 {
5375 coding->produced -= emacs_write (desc, SDATA (coding->dst_object), 5394 coding->produced -=
5376 coding->produced); 5395 emacs_write (desc,
5396 STRINGP (coding->dst_object)
5397 ? SDATA (coding->dst_object)
5398 : BYTE_POS_ADDR (coding->dst_pos_byte),
5399 coding->produced);
5377 5400
5378 if (coding->produced) 5401 if (coding->produced)
5379 { 5402 {