Mercurial > emacs
diff src/coding.c @ 83255:9684495d72bc
Merged from miles@gnu.org--gnu-2005 (patch 14-16, 95-106)
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-95
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-96
Move Gnus images into etc/images
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-97
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-98
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-99
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-100
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-101
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-102
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-103
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-104
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-105
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-106
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-14
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-15
Update from CVS: lisp/imap.el (imap-log): Doc fix.
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-16
Merge from emacs--cvs-trunk--0
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-295
| author | Karoly Lorentey <lorentey@elte.hu> |
|---|---|
| date | Sat, 19 Feb 2005 00:06:48 +0000 |
| parents | 3dcba0bc766b 8d84cdf36525 |
| children | 48ba3f89c89f |
line wrap: on
line diff
--- a/src/coding.c Fri Feb 18 23:22:51 2005 +0000 +++ b/src/coding.c Sat Feb 19 00:06:48 2005 +0000 @@ -6357,7 +6357,12 @@ if (SYMBOLP (coding->pre_write_conversion) && !NILP (Ffboundp (coding->pre_write_conversion))) - str = run_pre_post_conversion_on_str (str, coding, 1); + { + str = run_pre_post_conversion_on_str (str, coding, 1); + /* As STR is just newly generated, we don't have to copy it + anymore. */ + nocopy = 1; + } from = 0; to = SCHARS (str); @@ -6365,21 +6370,10 @@ /* Encoding routines determine the multibyteness of the source text by coding->src_multibyte. */ - coding->src_multibyte = STRING_MULTIBYTE (str); + coding->src_multibyte = SCHARS (str) < SBYTES (str); coding->dst_multibyte = 0; if (! CODING_REQUIRE_ENCODING (coding)) - { - coding->consumed = SBYTES (str); - coding->consumed_char = SCHARS (str); - if (STRING_MULTIBYTE (str)) - { - str = Fstring_as_unibyte (str); - nocopy = 1; - } - coding->produced = SBYTES (str); - coding->produced_char = SCHARS (str); - return (nocopy ? str : Fcopy_sequence (str)); - } + goto no_need_of_encoding; if (coding->composing != COMPOSITION_DISABLED) coding_save_composition (coding, from, to, str); @@ -6395,7 +6389,7 @@ if (from == to_byte) { coding_free_composition_data (coding); - return (nocopy ? str : Fcopy_sequence (str)); + goto no_need_of_encoding; } shrinked_bytes = from + (SBYTES (str) - to_byte); } @@ -6440,6 +6434,25 @@ coding_free_composition_data (coding); return newstr; + + no_need_of_encoding: + coding->consumed = SBYTES (str); + coding->consumed_char = SCHARS (str); + if (STRING_MULTIBYTE (str)) + { + if (nocopy) + /* We are sure that STR doesn't contain a multibyte + character. */ + STRING_SET_UNIBYTE (str); + else + { + str = Fstring_as_unibyte (str); + nocopy = 1; + } + } + coding->produced = SBYTES (str); + coding->produced_char = SCHARS (str); + return (nocopy ? str : Fcopy_sequence (str)); }
