diff options
author | Eli Zaretskii <eliz@gnu.org> | 2016-02-27 13:58:16 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2016-02-27 13:58:16 +0200 |
commit | 2fa05dcd5e79b9dcd5cf2923c11bbcb5c92ae148 (patch) | |
tree | 1df4828404f60a68a2799e784bfd6243c313a7b0 /src/coding.c | |
parent | 10a364d6737a84ebe2ec71ee107a4aef80660aae (diff) | |
download | emacs-2fa05dcd5e79b9dcd5cf2923c11bbcb5c92ae148.tar.gz |
Remove unused code in coding.c
* src/coding.c (decode_eol): Remove unused code that handled the
case of coding->dst_object being nil. Replace it with an
assertion.
Diffstat (limited to 'src/coding.c')
-rw-r--r-- | src/coding.c | 48 |
1 files changed, 19 insertions, 29 deletions
diff --git a/src/coding.c b/src/coding.c index e591bedc3e5..f5fe52e04c0 100644 --- a/src/coding.c +++ b/src/coding.c @@ -6814,39 +6814,29 @@ decode_eol (struct coding_system *coding) else if (EQ (eol_type, Qdos)) { ptrdiff_t n = 0; + ptrdiff_t pos = coding->dst_pos; + ptrdiff_t pos_byte = coding->dst_pos_byte; + ptrdiff_t pos_end = pos_byte + coding->produced - 1; - if (NILP (coding->dst_object)) - { - /* Start deleting '\r' from the tail to minimize the memory - movement. */ - for (p = pend - 2; p >= pbeg; p--) - if (*p == '\r') - { - memmove (p, p + 1, pend-- - p - 1); - n++; - } - } - else - { - ptrdiff_t pos = coding->dst_pos; - ptrdiff_t pos_byte = coding->dst_pos_byte; - ptrdiff_t pos_end = pos_byte + coding->produced - 1; + /* This assertion is here instead of code, now deleted, that + handled the NILP case, which no longer happens with the + current codebase. */ + eassert (!NILP (coding->dst_object)); - while (pos_byte < pos_end) + while (pos_byte < pos_end) + { + p = BYTE_POS_ADDR (pos_byte); + if (*p == '\r' && p[1] == '\n') { - p = BYTE_POS_ADDR (pos_byte); - if (*p == '\r' && p[1] == '\n') - { - del_range_2 (pos, pos_byte, pos + 1, pos_byte + 1, 0); - n++; - pos_end--; - } - pos++; - if (coding->dst_multibyte) - pos_byte += BYTES_BY_CHAR_HEAD (*p); - else - pos_byte++; + del_range_2 (pos, pos_byte, pos + 1, pos_byte + 1, 0); + n++; + pos_end--; } + pos++; + if (coding->dst_multibyte) + pos_byte += BYTES_BY_CHAR_HEAD (*p); + else + pos_byte++; } coding->produced -= n; coding->produced_char -= n; |