Skip to content

Commit

Permalink
AK: Hide the infallible make<T> factory function from the Kernel
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
IdanHo authored and awesomekling committed Feb 3, 2022
1 parent 7933a9b commit ba0a2a3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions AK/NonnullOwnPtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ inline NonnullOwnPtr<T> adopt_own(T& object)
return NonnullOwnPtr<T>(NonnullOwnPtr<T>::Adopt, object);
}

#endif

template<class T, class... Args>
requires(IsConstructible<T, Args...>) inline NonnullOwnPtr<T> make(Args&&... args)
{
Expand All @@ -174,6 +172,8 @@ inline NonnullOwnPtr<T> make(Args&&... args)
return NonnullOwnPtr<T>(NonnullOwnPtr<T>::Adopt, *new T { forward<Args>(args)... });
}

#endif

template<typename T>
struct Traits<NonnullOwnPtr<T>> : public GenericTraits<NonnullOwnPtr<T>> {
using PeekType = T*;
Expand All @@ -200,6 +200,6 @@ struct Formatter<NonnullOwnPtr<T>> : Formatter<const T*> {

#if !defined(KERNEL)
using AK::adopt_own;
#endif
using AK::make;
#endif
using AK::NonnullOwnPtr;

0 comments on commit ba0a2a3

Please sign in to comment.