aboutsummaryrefslogtreecommitdiff
path: root/files.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2021-01-18 10:30:17 -0800
committerBruce Hill <bruce@bruce-hill.com>2021-01-18 10:30:17 -0800
commiteece8c85564b9c5ae0cb3edfe7edb684242e9227 (patch)
treea3de972d08072bd4e7d5b626693ae174542cc58e /files.c
parent7f0c3804dce7591332bbf6bd0922597ea675df44 (diff)
More static analyzer cleanup, including switching to use bools where
appropriate and EXIT_SUCESS/EXIT_FAILURE
Diffstat (limited to 'files.c')
-rw-r--r--files.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/files.c b/files.c
index 170c8ce..d111e4f 100644
--- a/files.c
+++ b/files.c
@@ -93,7 +93,7 @@ file_t *load_file(file_t **files, const char *filename)
}
finished_loading:
- if (fd != STDIN_FILENO) check(!close(fd), "Failed to close file");
+ if (fd != STDIN_FILENO) check(close(fd) == 0, "Failed to close file");
f->end = &f->contents[length];
populate_lines(f);
if (files != NULL) {
@@ -131,7 +131,7 @@ void intern_file(file_t *f)
size_t size = (size_t)(f->end - f->contents);
char *buf = xcalloc(sizeof(char), size + 1);
memcpy(buf, f->contents, size);
- check(!munmap(f->contents, size),
+ check(munmap(f->contents, size) == 0,
"Failure to un-memory-map some memory");
f->contents = buf;
f->end = buf + size;
@@ -156,7 +156,7 @@ void destroy_file(file_t **f)
if ((*f)->contents) {
if ((*f)->mmapped) {
- check(!munmap((*f)->contents, (size_t)((*f)->end - (*f)->contents)),
+ check(munmap((*f)->contents, (size_t)((*f)->end - (*f)->contents)) == 0,
"Failure to un-memory-map some memory");
(*f)->contents = NULL;
} else {