From ba0a2a3e2f42f3f550aa6491c6031538b644c072 Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Thu, 3 Feb 2022 16:47:43 +0200 Subject: [PATCH] AK: Hide the infallible make factory function from the Kernel This function has no users, nor should it ever be used in the kernel, as all allocation failures in the Kernel should be explicitly checked. --- AK/NonnullOwnPtr.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AK/NonnullOwnPtr.h b/AK/NonnullOwnPtr.h index 8121467e5b8..87be16e2614 100644 --- a/AK/NonnullOwnPtr.h +++ b/AK/NonnullOwnPtr.h @@ -159,8 +159,6 @@ inline NonnullOwnPtr adopt_own(T& object) return NonnullOwnPtr(NonnullOwnPtr::Adopt, object); } -#endif - template requires(IsConstructible) inline NonnullOwnPtr make(Args&&... args) { @@ -174,6 +172,8 @@ inline NonnullOwnPtr make(Args&&... args) return NonnullOwnPtr(NonnullOwnPtr::Adopt, *new T { forward(args)... }); } +#endif + template struct Traits> : public GenericTraits> { using PeekType = T*; @@ -200,6 +200,6 @@ struct Formatter> : Formatter { #if !defined(KERNEL) using AK::adopt_own; -#endif using AK::make; +#endif using AK::NonnullOwnPtr;