From 6e712fca3ef6c49109d9e8e3f61d8befa0bf0a86 Mon Sep 17 00:00:00 2001 From: Soikk Date: Fri, 13 Jun 2025 15:48:09 +0200 Subject: Renamed file mapping functions --- str/str.c | 6 +++--- str/str.h | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'str') diff --git a/str/str.c b/str/str.c index b45227c..c336520 100755 --- a/str/str.c +++ b/str/str.c @@ -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; diff --git a/str/str.h b/str/str.h index 9a6a0e5..a270bb1 100755 --- a/str/str.h +++ b/str/str.h @@ -8,6 +8,7 @@ #include #include #include +#include #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); -- cgit v1.2.3