diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-01-18 10:30:17 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-01-18 10:30:17 -0800 |
| commit | eece8c85564b9c5ae0cb3edfe7edb684242e9227 (patch) | |
| tree | a3de972d08072bd4e7d5b626693ae174542cc58e /files.c | |
| parent | 7f0c3804dce7591332bbf6bd0922597ea675df44 (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.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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 { |
