mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:18:12 +00:00
AK: Rename adopt() to adopt_ref()
This makes it more symmetrical with adopt_own() (which is used to create a NonnullOwnPtr from the result of a naked new.)
This commit is contained in:
parent
b3db01e20e
commit
b91c49364d
228 changed files with 461 additions and 461 deletions
|
@ -15,7 +15,7 @@ struct Object : public RefCounted<Object> {
|
|||
|
||||
TEST_CASE(basics)
|
||||
{
|
||||
auto object = adopt(*new Object);
|
||||
auto object = adopt_ref(*new Object);
|
||||
EXPECT(object.ptr() != nullptr);
|
||||
EXPECT_EQ(object->ref_count(), 1u);
|
||||
object->ref();
|
||||
|
@ -33,7 +33,7 @@ TEST_CASE(basics)
|
|||
|
||||
TEST_CASE(assign_reference)
|
||||
{
|
||||
auto object = adopt(*new Object);
|
||||
auto object = adopt_ref(*new Object);
|
||||
EXPECT_EQ(object->ref_count(), 1u);
|
||||
object = *object;
|
||||
EXPECT_EQ(object->ref_count(), 1u);
|
||||
|
@ -45,8 +45,8 @@ TEST_CASE(assign_owner_of_self)
|
|||
RefPtr<Object> parent;
|
||||
};
|
||||
|
||||
auto parent = adopt(*new Object);
|
||||
auto child = adopt(*new Object);
|
||||
auto parent = adopt_ref(*new Object);
|
||||
auto child = adopt_ref(*new Object);
|
||||
child->parent = move(parent);
|
||||
|
||||
child = *child->parent;
|
||||
|
@ -55,7 +55,7 @@ TEST_CASE(assign_owner_of_self)
|
|||
|
||||
TEST_CASE(swap_with_self)
|
||||
{
|
||||
auto object = adopt(*new Object);
|
||||
auto object = adopt_ref(*new Object);
|
||||
swap(object, object);
|
||||
EXPECT_EQ(object->ref_count(), 1u);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue