From 8b73f2bac34c36a0ec008fb1e55aad77eb219afa Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Thu, 6 Feb 2025 21:01:26 +0100 Subject: MemoryMgr.h: Tweak mm_new_class to return if either allocation is successful or not. Signed-off-by: Amlal El Mahrouss --- dev/Kernel/KernelKit/MemoryMgr.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dev/Kernel/KernelKit/MemoryMgr.h b/dev/Kernel/KernelKit/MemoryMgr.h index 05288704..1c42d71d 100644 --- a/dev/Kernel/KernelKit/MemoryMgr.h +++ b/dev/Kernel/KernelKit/MemoryMgr.h @@ -62,16 +62,17 @@ namespace Kernel /// @param cls The class to allocate. /// @param args The args to pass. template - inline Void mm_new_class(_Input _Output T** cls, _Input Args&&... args) + inline BOOL mm_new_class(_Input _Output T** cls, _Input Args&&... args) { if (*cls) { err_global_get() = Kernel::kErrorInvalidData; - return; + return NO; } *cls = new T(move(args)...); - } + return *cls; + } /// @brief Delete and nullify C++ class. /// @param cls The class to delete. -- cgit v1.2.3