mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-02 05:57:46 +00:00
tac: lock stdout only once instead for each line
This commit is contained in:
parent
e041fda51d
commit
0d583754ca
1 changed files with 4 additions and 2 deletions
|
@ -105,7 +105,8 @@ fn buffer_tac_regex(
|
||||||
pattern: ®ex::bytes::Regex,
|
pattern: ®ex::bytes::Regex,
|
||||||
before: bool,
|
before: bool,
|
||||||
) -> std::io::Result<()> {
|
) -> 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.
|
// 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
|
/// `separator` appears at the beginning of each line, as in
|
||||||
/// `"/abc/def"`.
|
/// `"/abc/def"`.
|
||||||
fn buffer_tac(data: &[u8], before: bool, separator: &str) -> std::io::Result<()> {
|
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.
|
// The number of bytes in the line separator.
|
||||||
let slen = separator.as_bytes().len();
|
let slen = separator.as_bytes().len();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue