Allow ENCODE_FILE and DECODE_FILE to use no-copy conversion
authorMattias Engdegård <mattiase@acm.org>
Tue, 7 Apr 2020 08:10:04 +0000 (10:10 +0200)
committerMattias Engdegård <mattiase@acm.org>
Sat, 11 Apr 2020 15:04:57 +0000 (17:04 +0200)
commita79019c16b23f40c29509b6c0bf6f79d87f18c1e
tree54586d19a1dc42b291095e87cb750dbadedcc615
parent1988ffbaed709dfc71126efbf06644476830f07e
Allow ENCODE_FILE and DECODE_FILE to use no-copy conversion

They already did return their argument under some circumstances;
this change broadens it to further reduce allocation in common cases
(bug#40407).

* src/coding.c (convert_string_nocopy): New function.
(decode_file_name, encode_file_name): Use convert_string_nocopy.
* src/coding.h (ENCODE_FILE, DECODE_FILE): Note the nocopy semantics.
src/coding.c
src/coding.h