From d7df7587213597fb2bc6c3a561bb3d7317d5b1ae Mon Sep 17 00:00:00 2001 From: Lieuwe Rooijakkers Date: Mon, 19 Aug 2024 01:40:26 +0200 Subject: toilet: code cleanup --- src/toilet.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/toilet.c b/src/toilet.c index aab9dcc..717afa4 100644 --- a/src/toilet.c +++ b/src/toilet.c @@ -98,22 +98,19 @@ static size_t count_lines(char *fname, FILE *f) { static size_t count_words(FILE *f) { #define BUF_SIZE 4096 - size_t nwords = 0; - static char buf[BUF_SIZE]; while (!feof(f)) { + static char buf[BUF_SIZE]; const size_t n = fread(buf, 1, BUF_SIZE, f); -#define IN(i) (i < n) - for (size_t i = 0; IN(i);) { + // (c) Tom Forging + for (size_t i = 0; i