From f320ea9087f162a62440aa72116393dd9415f89a Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 16 Mar 2025 12:32:06 +0000 Subject: Update win32memory to comply with the InspIRCd coding standards. [skip alpine ci] [skip irctest ci] [skip macos ci] [skip ubuntu ci] --- win/win32memory.cpp | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/win/win32memory.cpp b/win/win32memory.cpp index 5b5284aee..5bdc37c87 100644 --- a/win/win32memory.cpp +++ b/win/win32memory.cpp @@ -24,9 +24,7 @@ */ -#include #include - #include /** On windows, all dll files and executables have their own private heap, @@ -39,31 +37,26 @@ * when it comes to memory usage between dlls and exes. */ -void * ::operator new(size_t iSize) +void* ::operator new(size_t count) { - void* ptr = HeapAlloc(GetProcessHeap(), 0, iSize); - /* This is the correct behaviour according to C++ standards for out of memory, - * not returning null -- Brain - */ + void* ptr = HeapAlloc(GetProcessHeap(), 0, count); if (!ptr) throw std::bad_alloc(); - else - return ptr; + return ptr; } -void ::operator delete(void * ptr) +void ::operator delete(void* ptr) { if (ptr) HeapFree(GetProcessHeap(), 0, ptr); } -void * operator new[] (size_t iSize) +void* operator new[](size_t count) { - void* ptr = HeapAlloc(GetProcessHeap(), 0, iSize); + void* ptr = HeapAlloc(GetProcessHeap(), 0, count); if (!ptr) throw std::bad_alloc(); - else - return ptr; + return ptr; } void operator delete[] (void* ptr) -- cgit v1.3.1-10-gc9f91