File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 5656// ===----------------------------------------------------------------------===//
5757// Mach change start
5858// #define C_ASSERT(expr) static_assert((expr), "")
59+ #define CoTaskMemRealloc realloc
5960// Mach change end
6061#define ATLASSERT assert
6162
Original file line number Diff line number Diff line change 2828
2929// ===--------------------------- CAllocator -------------------------------===//
3030
31+ // Mach change start
32+ // void *CAllocator::Reallocate(void *p, size_t nBytes) throw() {
33+ // return realloc(p, nBytes);
34+ // }
35+ // void *CAllocator::Allocate(size_t nBytes) throw() { return malloc(nBytes); }
36+ // void CAllocator::Free(void *p) throw() { free(p); }
37+
38+ // In ZigGNUWinAdapter we make use of CAllocator, and it needs to interop with the real
39+ // Windows COM API and use the same underlying allocator. So we redirect these allocations
40+ // to CoTaskMem* in all cases. On macOS/Linux these are just redirected to malloc/free
41+ // anyway in WinAdapter.h
3142void *CAllocator::Reallocate (void *p, size_t nBytes) throw() {
32- return realloc (p, nBytes);
43+ return CoTaskMemRealloc (p, nBytes);
3344}
34- void *CAllocator::Allocate (size_t nBytes) throw() { return malloc (nBytes); }
35- void CAllocator::Free (void *p) throw() { free (p); }
45+ void *CAllocator::Allocate (size_t nBytes) throw() { return CoTaskMemAlloc (nBytes); }
46+ void CAllocator::Free (void *p) throw() { CoTaskMemFree (p); }
47+ // Mach change end
3648
3749// Mach change start
3850#ifndef _WIN32
You can’t perform that action at this time.
0 commit comments