1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-08-01 05:27:45 +00:00

tac: lock stdout only once instead for each line

This commit is contained in:
Adam Reichold 2021-10-06 21:38:08 +02:00
parent e041fda51d
commit 0d583754ca

View file

@ -105,7 +105,8 @@ fn buffer_tac_regex(
pattern: &regex::bytes::Regex,
before: bool,
) -> std::io::Result<()> {
let mut out = stdout();
let out = stdout();
let mut out = out.lock();
// The index of the line separator for the current line.
//
@ -171,7 +172,8 @@ fn buffer_tac_regex(
/// `separator` appears at the beginning of each line, as in
/// `"/abc/def"`.
fn buffer_tac(data: &[u8], before: bool, separator: &str) -> std::io::Result<()> {
let mut out = stdout();
let out = stdout();
let mut out = out.lock();
// The number of bytes in the line separator.
let slen = separator.as_bytes().len();