From dd420cbfcf55776208ddd4f2dd0d0f8d2f8f5f10 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Fri, 28 Jun 2024 13:12:50 +1000 Subject: [PATCH] Common: Alloc failures in HeapArray are unlikely --- src/common/heap_array.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/heap_array.h b/src/common/heap_array.h index 474dcf640..9a5a6a02d 100644 --- a/src/common/heap_array.h +++ b/src/common/heap_array.h @@ -9,8 +9,8 @@ #include #include #include -#include #include +#include template class FixedHeapArray @@ -361,10 +361,10 @@ private: { #ifdef _MSC_VER m_data = static_cast(_aligned_realloc(prev_ptr, size * sizeof(T), alignment)); - if (!m_data) + if (!m_data) [[unlikely]] Panic("Memory allocation failed."); #else - if (posix_memalign(reinterpret_cast(&m_data), alignment, size * sizeof(T)) != 0) + if (posix_memalign(reinterpret_cast(&m_data), alignment, size * sizeof(T)) != 0) [[unlikely]] Panic("Memory allocation failed."); if (prev_ptr) @@ -377,7 +377,7 @@ private: else { m_data = static_cast(std::realloc(prev_ptr, size * sizeof(T))); - if (!m_data) + if (!m_data) [[unlikely]] Panic("Memory allocation failed."); }