From e269430d133ab4e88d3b02d954f65ef69930c3f2 Mon Sep 17 00:00:00 2001 From: Camden Dixie O'Brien Date: Sat, 15 Oct 2022 20:23:07 +0100 Subject: [PATCH] Replace while(true) loop with do ... while() --- main.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 6ada7e5..7fdeffa 100644 --- a/main.c +++ b/main.c @@ -361,7 +361,7 @@ int main(int argc, char *argv[]) * endings is done with a buffered reading approach to * minimize syscalls (as opposed to using fgetc()). */ - while (true) { + do { /* Fill fbuf from file. */ n = fread(fbuf, sizeof(*fbuf), FBUF_SIZE, rf); if (n != FBUF_SIZE && ferror(rf)) { @@ -386,10 +386,7 @@ int main(int argc, char *argv[]) rbuf[rlen++] = fbuf[fpos]; } } - - if (feof(rf)) - break; - } + } while (!feof(rf)); fclose(rf); } else if (S_ISDIR(rstat.st_mode)) {