From 962562cde45071f74a37854a299e88470a4ecd49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Sun, 5 Apr 2020 11:27:36 +0200 Subject: Fix inverted NOCOPY encode/decode parameter (bug#40407) In {encode,decode}-coding-string, the NOCOPY parameter had the opposite effect to what was intended and documented. This 18 year old bug (introduced in 4031e2bf0a) only affected calls with CODING-SYSTEM being nil. * src/coding.c (code_convert_string): Correct use of NOCOPY. * test/src/coding-tests.el (coding-nocopy-trivial): New test. --- src/coding.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/coding.c') diff --git a/src/coding.c b/src/coding.c index f0fc37dbdfa..1049f1b755a 100644 --- a/src/coding.c +++ b/src/coding.c @@ -9485,7 +9485,7 @@ code_convert_string (Lisp_Object string, Lisp_Object coding_system, if (! norecord) Vlast_coding_system_used = Qno_conversion; if (NILP (dst_object)) - return (nocopy ? Fcopy_sequence (string) : string); + return nocopy ? string : Fcopy_sequence (string); } if (NILP (coding_system)) -- cgit v1.2.1