]> git.eshelyaron.com Git - emacs.git/commit
Fix ASCII-only conversion logic (bug#40407)
authorMattias Engdegård <mattiase@acm.org>
Thu, 9 Apr 2020 10:04:22 +0000 (12:04 +0200)
committerMattias Engdegård <mattiase@acm.org>
Thu, 9 Apr 2020 10:50:35 +0000 (12:50 +0200)
commitd3e2c88041b4844422bda64b1ee51678dc8a2e88
tree5108104aceb42394dcf860759ab0b85a140521a4
parent95dd8de1df19a8529efb66257ac78789be62ca37
Fix ASCII-only conversion logic (bug#40407)

To sidestep conversion altogether when EOL conversion applies, we must
either be encoding a string without NL, or decoding without CR.

* src/coding.c (string_ascii_p): Revert to a pure predicate.
(code_convert_string): Fix logic.  Don't use uninitialised
ascii_p (removed).  Use memchr to detect CR or LF in string when needed.
* test/src/coding-tests.el (coding-nocopy-ascii):
Update tests to include encodings with explicit EOL conversions.
src/coding.c
test/src/coding-tests.el