ladybird/Kernel/VM/PrivateInodeVMObject.cpp
Daniel Bertalan f820917a76 Everywhere: Use nothrow new with adopt_{ref,own}_if_nonnull
This commit converts naked `new`s to `AK::try_make` and `AK::try_create`
wherever possible. If the called constructor is private, this can not be
done, so we instead now use the standard-defined and compiler-agnostic
`new (nothrow)`.
2021-06-24 17:35:49 +04:30

37 lines
791 B
C++

/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <Kernel/FileSystem/Inode.h>
#include <Kernel/VM/PrivateInodeVMObject.h>
namespace Kernel {
RefPtr<PrivateInodeVMObject> PrivateInodeVMObject::create_with_inode(Inode& inode)
{
return adopt_ref_if_nonnull(new (nothrow) PrivateInodeVMObject(inode, inode.size()));
}
RefPtr<VMObject> PrivateInodeVMObject::clone()
{
return adopt_ref_if_nonnull(new (nothrow) PrivateInodeVMObject(*this));
}
PrivateInodeVMObject::PrivateInodeVMObject(Inode& inode, size_t size)
: InodeVMObject(inode, size)
{
}
PrivateInodeVMObject::PrivateInodeVMObject(const PrivateInodeVMObject& other)
: InodeVMObject(other)
{
}
PrivateInodeVMObject::~PrivateInodeVMObject()
{
}
}