#include "core/utils/New.hpp" #include #include "ErrorSimulator.hpp" void* operator new(size_t bytes) noexcept { #ifdef ERROR_SIMULATOR if(Core::Fail::leftAllocations > 0) { Core::Fail::leftAllocations--; } else if(Core::Fail::leftAllocations == 0) { return nullptr; } #endif return malloc(bytes); } void* operator new[](size_t bytes) noexcept { #ifdef ERROR_SIMULATOR if(Core::Fail::leftAllocations > 0) { Core::Fail::leftAllocations--; } else if(Core::Fail::leftAllocations == 0) { return nullptr; } #endif return malloc(bytes); } void operator delete(void* p) noexcept { free(p); } void operator delete[](void* p) noexcept { free(p); } void operator delete(void* p, size_t bytes) noexcept { (void)bytes; operator delete(p); } void operator delete[](void* p, size_t bytes) noexcept { (void)bytes; free(p); } void* operator new(size_t bytes, void* p) noexcept { (void)bytes; return p; }