From b43278439a8c764aac7fc55cbd532bf86593185e Mon Sep 17 00:00:00 2001 From: John Platts Date: Mon, 19 Sep 2022 13:26:01 -0500 Subject: [PATCH] Delete AllocRoutines.h --- .../src/main/AllocRoutines.h | 44 ------------------- 1 file changed, 44 deletions(-) delete mode 100644 flatlaf-natives/flatlaf-natives-windows/src/main/AllocRoutines.h diff --git a/flatlaf-natives/flatlaf-natives-windows/src/main/AllocRoutines.h b/flatlaf-natives/flatlaf-natives-windows/src/main/AllocRoutines.h deleted file mode 100644 index f4a8f0fc..00000000 --- a/flatlaf-natives/flatlaf-natives-windows/src/main/AllocRoutines.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef FLATLAF_WIN32_ALLOCROUTINES_H -#define FLATLAF_WIN32_ALLOCROUTINES_H - -#include -#include - -struct NoThrowingWin32HeapAllocT { -}; - -constexpr NoThrowingWin32HeapAllocT NoThrowingWin32HeapAlloc{}; - -#if defined(_MSC_VER) -#define FLATLAF_WIN32_ALLOC_INLINE __forceinline -#elif (defined(__GNUC__) || defined(__clang__)) -#define FLATLAF_WIN32_ALLOC_INLINE inline __attribute__((__always_inline__)) -#else -#define FLATLAF_WIN32_ALLOC_INLINE inline -#endif - -FLATLAF_WIN32_ALLOC_INLINE void* AllocateUsingProcessHeap(size_t cb) noexcept { - return ::HeapAlloc(::GetProcessHeap(), HEAP_ZERO_MEMORY, cb); -} - -FLATLAF_WIN32_ALLOC_INLINE void DeleteFromProcessHeap(void* pv) noexcept { - if(pv) - ::HeapFree(::GetProcessHeap(), 0, pv); -} - -FLATLAF_WIN32_ALLOC_INLINE void* operator new(size_t cb, const NoThrowingWin32HeapAllocT& tag) noexcept { - return AllocateUsingProcessHeap(cb); -} - -inline void* operator new[](size_t cb, const NoThrowingWin32HeapAllocT& tag) noexcept { - return AllocateUsingProcessHeap(cb); -} - -inline void operator delete(void* pv, const NoThrowingWin32HeapAllocT& tag) noexcept { - DeleteFromProcessHeap(pv); -} - -inline void operator delete[](void* pv, const NoThrowingWin32HeapAllocT& tag) noexcept { - DeleteFromProcessHeap(pv); -} -#endif