From a1d1e221ae53c9a12e45c9eeae9f6f708517e7bf Mon Sep 17 00:00:00 2001 From: John Platts Date: Mon, 19 Sep 2022 14:23:16 -0500 Subject: [PATCH] Remove operator new and operator delete overloads from Runtime.cpp The ```operator new``` and ```operator delete``` overloads in Runtime.cpp are replaced by placement ```operator new``` and ```operator delete``` operators in AllocRoutines.h that take a const FlatLafNoThrowT& placement parameter. Using ```new (FlatLafNoThrow) FlatWndProc``` instead of ```new FlatWndProc``` also allows for inlining by the C++ compiler. --- .../src/main/cpp/Runtime.cpp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/flatlaf-natives/flatlaf-natives-windows/src/main/cpp/Runtime.cpp b/flatlaf-natives/flatlaf-natives-windows/src/main/cpp/Runtime.cpp index efe5f3ac..582a67d5 100644 --- a/flatlaf-natives/flatlaf-natives-windows/src/main/cpp/Runtime.cpp +++ b/flatlaf-natives/flatlaf-natives-windows/src/main/cpp/Runtime.cpp @@ -41,19 +41,6 @@ BOOL WINAPI _DllMainCRTStartup( HINSTANCE instance, DWORD reason, LPVOID reserve return TRUE; } -void* __cdecl operator new( size_t cb ) { - return ::HeapAlloc( ::GetProcessHeap(), HEAP_ZERO_MEMORY, cb ); -} - -void* __cdecl operator new[]( size_t cb ) { - return ::HeapAlloc( ::GetProcessHeap(), HEAP_ZERO_MEMORY, cb ); -} - -void __cdecl operator delete( void* pv, size_t cb ) { - if( pv != NULL ) - ::HeapFree( ::GetProcessHeap(), 0, pv ); -} - /* extern "C" int __cdecl printf( const char* format, ... ) {