Introduce mg_calloc

This commit is contained in:
Sergey Lyubka committed 2025-06-24 10:52:44 +01:00
1 parent 5f1f4a0df8
commit 074ef5197b
26 files changed
+259 -313

No files matched your search

+2 -2
View File
@@ -74,7 +74,7 @@ static void *ff_open(const char *path, int flags) {
if (flags & MG_FS_WRITE) mode |= FA_WRITE | FA_OPEN_ALWAYS | FA_OPEN_APPEND;
if (f_open(&f, path, mode) == 0) {
FIL *fp;
if ((fp = calloc(1, sizeof(*fp))) != NULL) {
if ((fp = mg_calloc(1, sizeof(*fp))) != NULL) {
memcpy(fp, &f, sizeof(*fp));
return fp;
}
@@ -85,7 +85,7 @@ static void *ff_open(const char *path, int flags) {
static void ff_close(void *fp) {
if (fp != NULL) {
f_close((FIL *) fp);
free(fp);
mg_free(fp);
}
}