mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:37:34 +00:00
Kernel: Remove dead code from ThreadSafeWeakPtr
This is a Kernel-only header, so any #ifndef KERNEL code is essentially dead.
This commit is contained in:
parent
b32cf33a23
commit
197ebe3433
1 changed files with 0 additions and 15 deletions
|
@ -138,17 +138,6 @@ public:
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef KERNEL
|
|
||||||
// A lot of user mode code is single-threaded. But for kernel mode code
|
|
||||||
// this is generally not true as everything is multi-threaded. So make
|
|
||||||
// these shortcuts and aliases only available to non-kernel code.
|
|
||||||
T* ptr() const { return unsafe_ptr(); }
|
|
||||||
T* operator->() { return unsafe_ptr(); }
|
|
||||||
const T* operator->() const { return unsafe_ptr(); }
|
|
||||||
operator const T*() const { return unsafe_ptr(); }
|
|
||||||
operator T*() { return unsafe_ptr(); }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
[[nodiscard]] T* unsafe_ptr() const
|
[[nodiscard]] T* unsafe_ptr() const
|
||||||
{
|
{
|
||||||
T* ptr = nullptr;
|
T* ptr = nullptr;
|
||||||
|
@ -219,12 +208,8 @@ template<typename T>
|
||||||
struct Formatter<WeakPtr<T>> : Formatter<const T*> {
|
struct Formatter<WeakPtr<T>> : Formatter<const T*> {
|
||||||
ErrorOr<void> format(FormatBuilder& builder, WeakPtr<T> const& value)
|
ErrorOr<void> format(FormatBuilder& builder, WeakPtr<T> const& value)
|
||||||
{
|
{
|
||||||
#ifdef KERNEL
|
|
||||||
auto ref = value.strong_ref();
|
auto ref = value.strong_ref();
|
||||||
return Formatter<const T*>::format(builder, ref.ptr());
|
return Formatter<const T*>::format(builder, ref.ptr());
|
||||||
#else
|
|
||||||
return Formatter<const T*>::format(builder, value.ptr());
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue