From 0d997e18b99e87fa2f2ca96f3611ada87758c020 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 4 Mar 2023 11:41:02 -0800 Subject: split: small -n lines simplification * src/split.c (lines_chunk_split): Rewrite while as if-while for clarity. --- src/split.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/split.c b/src/split.c index d3d1dde8c..574250d27 100644 --- a/src/split.c +++ b/src/split.c @@ -980,8 +980,9 @@ lines_chunk_split (uintmax_t k, uintmax_t n, char *buf, size_t bufsize, /* Ensure NUMBER files are created, which truncates any existing files or notifies any consumers on fifos. FIXME: Should we do this before EXIT_FAILURE? */ - while (!k && chunk_no++ <= n) - cwrite (true, NULL, 0); + if (!k) + while (chunk_no++ <= n) + cwrite (true, NULL, 0); } /* -n K/N: Extract Kth of N chunks. */ -- cgit v1.2.1