mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-28 12:30:58 +00:00
Add sizep param to mg_file_read()
This commit is contained in:
1 parent
381d7cce54
commit
4528cc28ef
7 files changed
+14
-12
No files matched your search
+2
-1
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user