Kernel: Pass InodeMetadata by reference in TmpFSInode::create
This struct is non-trivially large, it makes sense to pass it by reference instead of by value in the factory method. Found by Sonar Cloud.
This commit is contained in:
parent
fee2a03ba9
commit
0678ac265c
Notes:
sideshowbarker
2024-07-18 22:57:59 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/0678ac265cb Pull-request: https://github.com/SerenityOS/serenity/pull/9720
2 changed files with 4 additions and 4 deletions
|
@ -72,7 +72,7 @@ RefPtr<Inode> TmpFS::get_inode(InodeIdentifier identifier) const
|
|||
return it->value;
|
||||
}
|
||||
|
||||
TmpFSInode::TmpFSInode(TmpFS& fs, InodeMetadata metadata, InodeIdentifier parent)
|
||||
TmpFSInode::TmpFSInode(TmpFS& fs, const InodeMetadata& metadata, InodeIdentifier parent)
|
||||
: Inode(fs, fs.next_inode_index())
|
||||
, m_metadata(metadata)
|
||||
, m_parent(parent)
|
||||
|
@ -84,7 +84,7 @@ TmpFSInode::~TmpFSInode()
|
|||
{
|
||||
}
|
||||
|
||||
RefPtr<TmpFSInode> TmpFSInode::create(TmpFS& fs, InodeMetadata metadata, InodeIdentifier parent)
|
||||
RefPtr<TmpFSInode> TmpFSInode::create(TmpFS& fs, const InodeMetadata& metadata, InodeIdentifier parent)
|
||||
{
|
||||
auto inode = adopt_ref_if_nonnull(new (nothrow) TmpFSInode(fs, metadata, parent));
|
||||
if (inode)
|
||||
|
|
|
@ -70,8 +70,8 @@ public:
|
|||
virtual void one_ref_left() override;
|
||||
|
||||
private:
|
||||
TmpFSInode(TmpFS& fs, InodeMetadata metadata, InodeIdentifier parent);
|
||||
static RefPtr<TmpFSInode> create(TmpFS&, InodeMetadata metadata, InodeIdentifier parent);
|
||||
TmpFSInode(TmpFS& fs, const InodeMetadata& metadata, InodeIdentifier parent);
|
||||
static RefPtr<TmpFSInode> create(TmpFS&, const InodeMetadata& metadata, InodeIdentifier parent);
|
||||
static RefPtr<TmpFSInode> create_root(TmpFS&);
|
||||
void notify_watchers();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue