mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
AK: Remove use of copy_ref().
This commit is contained in:
parent
5254a320d8
commit
b0372883ff
Notes:
sideshowbarker
2024-07-19 13:19:52 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/b0372883fff
4 changed files with 11 additions and 8 deletions
|
@ -45,7 +45,7 @@ public:
|
|||
}
|
||||
|
||||
String(const String& other)
|
||||
: m_impl(const_cast<String&>(other).m_impl.copy_ref())
|
||||
: m_impl(const_cast<String&>(other).m_impl)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ public:
|
|||
String& operator=(const String& other)
|
||||
{
|
||||
if (this != &other)
|
||||
m_impl = const_cast<String&>(other).m_impl.copy_ref();
|
||||
m_impl = const_cast<String&>(other).m_impl;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ public:
|
|||
ByteBuffer() {}
|
||||
ByteBuffer(std::nullptr_t) {}
|
||||
ByteBuffer(const ByteBuffer& other)
|
||||
: m_impl(other.m_impl.copy_ref())
|
||||
: m_impl(other.m_impl)
|
||||
{
|
||||
}
|
||||
ByteBuffer(ByteBuffer&& other)
|
||||
|
@ -97,7 +97,8 @@ public:
|
|||
}
|
||||
ByteBuffer& operator=(const ByteBuffer& other)
|
||||
{
|
||||
m_impl = other.m_impl.copy_ref();
|
||||
if (this != &other)
|
||||
m_impl = other.m_impl;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,13 +64,15 @@ public:
|
|||
{
|
||||
}
|
||||
RefPtr(const RefPtr& other)
|
||||
: m_ptr(const_cast<RefPtr&>(other).copy_ref().leak_ref())
|
||||
: m_ptr(const_cast<T*>(other.ptr()))
|
||||
{
|
||||
ref_if_not_null(m_ptr);
|
||||
}
|
||||
template<typename U>
|
||||
RefPtr(const RefPtr<U>& other)
|
||||
: m_ptr(const_cast<RefPtr<U>&>(other).copy_ref().leak_ref())
|
||||
: m_ptr(static_cast<T*>(const_cast<U*>(other.ptr())))
|
||||
{
|
||||
ref_if_not_null(m_ptr);
|
||||
}
|
||||
~RefPtr()
|
||||
{
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
bool operator==(const OwnPtr<T>& other) const { return ptr() == other.ptr(); }
|
||||
|
||||
private:
|
||||
WeakPtr(RefPtr<WeakLink<T>>&& link)
|
||||
WeakPtr(RefPtr<WeakLink<T>> link)
|
||||
: m_link(move(link))
|
||||
{
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ inline WeakPtr<T> Weakable<T>::make_weak_ptr()
|
|||
{
|
||||
if (!m_link)
|
||||
m_link = adopt(*new WeakLink<T>(static_cast<T&>(*this)));
|
||||
return WeakPtr<T>(m_link.copy_ref());
|
||||
return WeakPtr<T>(m_link);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
|
Loading…
Reference in a new issue