More bools
This commit is contained in:
parent
d12cf8abbd
commit
97cf726442
6
files.c
6
files.c
@ -76,12 +76,12 @@ file_t *load_file(file_t **files, const char *filename)
|
||||
if (f->contents == MAP_FAILED)
|
||||
goto skip_mmap;
|
||||
|
||||
f->mmapped = 1;
|
||||
f->mmapped = true;
|
||||
length = (size_t)sb.st_size;
|
||||
goto finished_loading;
|
||||
|
||||
skip_mmap:
|
||||
f->mmapped = 0;
|
||||
f->mmapped = false;
|
||||
size_t capacity = 1000;
|
||||
length = 0;
|
||||
f->contents = xcalloc(sizeof(char), capacity);
|
||||
@ -135,7 +135,7 @@ void intern_file(file_t *f)
|
||||
"Failure to un-memory-map some memory");
|
||||
f->contents = buf;
|
||||
f->end = buf + size;
|
||||
f->mmapped = 0;
|
||||
f->mmapped = false;
|
||||
xfree(&f->lines);
|
||||
populate_lines(f);
|
||||
}
|
||||
|
3
files.h
3
files.h
@ -4,6 +4,7 @@
|
||||
#ifndef FILES__H
|
||||
#define FILES__H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
struct allocated_pat_s; // declared in types.h
|
||||
@ -14,7 +15,7 @@ typedef struct file_s {
|
||||
char *contents, **lines, *end;
|
||||
size_t nlines;
|
||||
struct allocated_pat_s *pats;
|
||||
unsigned int mmapped:1;
|
||||
bool mmapped:1;
|
||||
} file_t;
|
||||
|
||||
__attribute__((nonnull(2)))
|
||||
|
Loading…
Reference in New Issue
Block a user