Add sizep param to mg_file_read()

This commit is contained in:
cpq committed 2021-03-15 09:16:34 +00:00
1 parent 381d7cce54
commit 4528cc28ef
7 files changed
+14 -12

No files matched your search

+2 -1
View File
@@ -33,7 +33,7 @@ int64_t mg_file_size(const char *path) {
#endif
}
char *mg_file_read(const char *path) {
char *mg_file_read(const char *path, size_t *sizep) {
FILE *fp;
char *data = NULL;
size_t size = (size_t) mg_file_size(path);
@@ -45,6 +45,7 @@ char *mg_file_read(const char *path) {
data = NULL;
} else {
data[size] = '\0';
if (sizep != NULL) *sizep = size;
}
}
fclose(fp);