diff options
| author | Soikk | 2025-06-13 15:48:09 +0200 |
|---|---|---|
| committer | Soikk | 2025-06-13 15:48:09 +0200 |
| commit | 6e712fca3ef6c49109d9e8e3f61d8befa0bf0a86 (patch) | |
| tree | 2494ebd8807db87ee882d31111707ba87696198c /str | |
| parent | 4dd45334f119cc44597d9bb30d9d377c7b7bbb7e (diff) | |
| download | soikk-libs-6e712fca3ef6c49109d9e8e3f61d8befa0bf0a86.tar.xz soikk-libs-6e712fca3ef6c49109d9e8e3f61d8befa0bf0a86.tar.zst | |
Renamed file mapping functions
Diffstat (limited to 'str')
| -rwxr-xr-x | str/str.c | 6 | ||||
| -rwxr-xr-x | str/str.h | 7 |
2 files changed, 7 insertions, 6 deletions
@@ -323,7 +323,7 @@ str file_to_nstr(char *filename, u32 len){ return s; } -str load_str(char *filename){ +str map_file(char *filename){ int fd = open(filename, 0); if(fd == -1){ return (str){0}; @@ -340,7 +340,7 @@ str load_str(char *filename){ return s; } -str load_nstr_at(char *filename, int len, int at){ +str map_file_at(char *filename, int len, int at){ int fd = open(filename, 0); if(fd == -1){ return (str){0}; @@ -357,7 +357,7 @@ str load_nstr_at(char *filename, int len, int at){ return s; } -void unload_str(str *s){ +void unmap_file(str *s){ munmap(s->ptr, s->len); config->ptr = NULL; config->len = 0; @@ -8,6 +8,7 @@ #include <string.h> #include <stdarg.h> #include <ctype.h> +#include <sys/mman.h> #include "types/types.h" #include "files/files.h" @@ -122,10 +123,10 @@ str fp_to_str(FILE *fp); str fp_to_nstr(FILE *fp, u32 len); str file_to_str(char *filename); str file_to_nstr(char *filename, u32 len); -str load_str(char *filename); +str map_file(char *filename); // consider adding 'at' to other file-to-str functions -str load_nstr_at(char *filename, int len, int at); -void unload_str(str *s); +str map_file_at(char *filename, int len, int at); +void unmap_file(str *s); void print_str(str s); |
