Commit b8196f36

b8196f362964Merged

Yasuhiro Matsumoto <[email protected]> · 7 months ago · 1 file · ~1 modified

Description

fix(runtime): treat Windows like Apple for malloc.h/malloc_trim

Drop the malloc_trim no-op macro for _WIN32 and exclude Windows from the malloc.h include, falling through to the Apple branch's no-op definition so call sites stay portable without per-platform shims.

Details

Commit
b8196f362964
Parent
fb0fc109eab4

lib/sp_runtime.hmodifiedView file

@@ -27,7 +27,6 @@
2727 #ifdef _WIN32
2828 #include <windows.h>
2929 /* POSIX compat shims for MinGW */
30-#define malloc_trim(x) ((void)0)
3130 #define mmap(a,l,p,f,fd,off) VirtualAlloc(NULL,(l),MEM_RESERVE|MEM_COMMIT,PAGE_READWRITE)
3231 #define munmap(a,l) (VirtualFree((a),0,MEM_RELEASE)?0:-1)
3332 #define MAP_FAILED NULL
@@ -41,7 +40,7 @@
4140 #include <unistd.h>
4241 #include <sys/mman.h>
4342 #endif
44-#ifndef __APPLE__
43+#if !defined(__APPLE__) && !defined(_WIN32)
4544 #include <malloc.h>
4645 #else
4746 /* Darwin's libc has no malloc_trim; make it a no-op so call sites stay portable. */