Kernel: Remove the infallible make_ref_counted<T> factory function

This function had no users, nor should it ever be used, as all
allocation failures in the Kernel should be explicitly checked.
This commit is contained in:
Idan Horowitz 2022-02-03 16:46:01 +02:00 committed by Andreas Kling
parent a65bbbdb71
commit 3dc8bbbc8b
Notes: sideshowbarker 2024-07-17 19:49:41 +09:00

View file

@ -336,18 +336,6 @@ inline void swap(NonnullRefPtr<T>& a, NonnullRefPtr<U>& b) requires(IsConvertibl
a.swap(b);
}
template<typename T, class... Args>
requires(IsConstructible<T, Args...>) inline NonnullRefPtr<T> make_ref_counted(Args&&... args)
{
return NonnullRefPtr<T>(NonnullRefPtr<T>::Adopt, *new T(forward<Args>(args)...));
}
// FIXME: Remove once P0960R3 is available in Clang.
template<typename T, class... Args>
inline NonnullRefPtr<T> make_ref_counted(Args&&... args)
{
return NonnullRefPtr<T>(NonnullRefPtr<T>::Adopt, *new T { forward<Args>(args)... });
}
}
template<typename T>
@ -359,5 +347,4 @@ struct Traits<NonnullRefPtr<T>> : public GenericTraits<NonnullRefPtr<T>> {
};
using AK::adopt_ref;
using AK::make_ref_counted;
using AK::NonnullRefPtr;