mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-17 01:10:28 +03:00
AK: Hide the infallible make<T> 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.
This commit is contained in:
parent
7933a9b6c8
commit
ba0a2a3e2f
Notes:
sideshowbarker
2024-07-17 19:49:33 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/ba0a2a3e2f4 Pull-request: https://github.com/SerenityOS/serenity/pull/12275
@ -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)
|
||||
{
|
||||
@ -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*;
|
||||
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user