From 941b5b19de78342af7018e6d0c90a73dcd946457 Mon Sep 17 00:00:00 2001 From: Nakidai Date: Tue, 15 Apr 2025 15:25:44 +0300 Subject: Move empty file check I find checking file for emptyness in tokenizer.c rather than just after reading more correct as file is read without any errors Also, warning won't be printed with -v anymore --- main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 301c59b..434d08e 100644 --- a/main.c +++ b/main.c @@ -72,9 +72,7 @@ int main(int argc, char **argv) #endif /* __OpenBSD__ */ int bytes_read = fread(file.buffer, 1, file.size, f); - if (!bytes_read) - return (verbose ? warnx("reading empty file") : 0, 0); - else if (ferror(f) || bytes_read != file.size) + if (ferror(f) || bytes_read != file.size) errx(1, "couldn't read %s", *argv); fclose(f); -- cgit 1.4.1