mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
cat: cleanup write_tab_to_end duplication of logic
The logic for '\n' and '\r' about the number of written characters was duplicated
This commit is contained in:
committed by
Michael Lohmann
parent
67cee26abe
commit
34b18351e2
@@ -560,13 +560,12 @@ fn write_tab_to_end<W: Write>(mut in_buf: &[u8], writer: &mut W) -> usize {
|
||||
{
|
||||
Some(p) => {
|
||||
writer.write_all(&in_buf[..p]).unwrap();
|
||||
if in_buf[p] == b'\n' {
|
||||
return count + p;
|
||||
} else if in_buf[p] == b'\t' {
|
||||
if in_buf[p] == b'\t' {
|
||||
writer.write_all(b"^I").unwrap();
|
||||
in_buf = &in_buf[p + 1..];
|
||||
count += p + 1;
|
||||
} else {
|
||||
// b'\n' or b'\r'
|
||||
return count + p;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user