diff options
author | dec05eba <dec05eba@protonmail.com> | 2023-07-09 19:07:08 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2023-07-09 19:07:08 +0200 |
commit | 15cb00dfffd777e97abf8732f84a3c3c3bd659e9 (patch) | |
tree | 1d0d399625edc249d736db1e7443afc2a2e84c19 | |
parent | cc142e3e8223b6854ea08ba944c0a24905eedf88 (diff) |
const
-rw-r--r-- | include/mgl/system/fileutils.h | 4 | ||||
-rw-r--r-- | src/system/fileutils.c | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/include/mgl/system/fileutils.h b/include/mgl/system/fileutils.h index 5add345..6a5d139 100644 --- a/include/mgl/system/fileutils.h +++ b/include/mgl/system/fileutils.h @@ -27,11 +27,11 @@ typedef struct { } mgl_memory_mapped_file_load_options; /* |load_options| can be null, in which case the default options are used */ -int mgl_load_file(const char *filepath, mgl_filedata *filedata, mgl_file_load_options *load_options); +int mgl_load_file(const char *filepath, mgl_filedata *filedata, const mgl_file_load_options *load_options); void mgl_filedata_free(mgl_filedata *self); /* |load_options| can be null, in which case the default options are used */ -int mgl_mapped_file_load(const char *filepath, mgl_memory_mapped_file *memory_mapped_file, mgl_memory_mapped_file_load_options *load_options); +int mgl_mapped_file_load(const char *filepath, mgl_memory_mapped_file *memory_mapped_file, const mgl_memory_mapped_file_load_options *load_options); void mgl_mapped_file_unload(mgl_memory_mapped_file *memory_mapped_file); #endif /* MGL_FILEUTILS_H */ diff --git a/src/system/fileutils.c b/src/system/fileutils.c index 86d176a..c2ffc20 100644 --- a/src/system/fileutils.c +++ b/src/system/fileutils.c @@ -5,7 +5,7 @@ #include <unistd.h> #include <stdlib.h> -int mgl_load_file(const char *filepath, mgl_filedata *filedata, mgl_file_load_options *load_options) { +int mgl_load_file(const char *filepath, mgl_filedata *filedata, const mgl_file_load_options *load_options) { const bool null_terminated = load_options ? load_options->null_terminated : false; int fd = open(filepath, O_RDONLY); @@ -51,7 +51,7 @@ void mgl_filedata_free(mgl_filedata *self) { self->size = 0; } -static int load_options_to_open_flag(mgl_memory_mapped_file_load_options *load_options) { +static int load_options_to_open_flag(const mgl_memory_mapped_file_load_options *load_options) { const bool readable = load_options ? load_options->readable : true; const bool writable = load_options ? load_options->writable : true; @@ -66,7 +66,7 @@ static int load_options_to_open_flag(mgl_memory_mapped_file_load_options *load_o return open_flag; } -static int load_options_to_mmap_prot_flag(mgl_memory_mapped_file_load_options *load_options) { +static int load_options_to_mmap_prot_flag(const mgl_memory_mapped_file_load_options *load_options) { const bool readable = load_options ? load_options->readable : true; const bool writable = load_options ? load_options->writable : true; @@ -79,7 +79,7 @@ static int load_options_to_mmap_prot_flag(mgl_memory_mapped_file_load_options *l return prot_flag; } -int mgl_mapped_file_load(const char *filepath, mgl_memory_mapped_file *memory_mapped_file, mgl_memory_mapped_file_load_options *load_options) { +int mgl_mapped_file_load(const char *filepath, mgl_memory_mapped_file *memory_mapped_file, const mgl_memory_mapped_file_load_options *load_options) { memory_mapped_file->data = NULL; memory_mapped_file->size = 0; memory_mapped_file->fd = -1; |