diff options
author | Lenny Maiorani <lenny@serenityos.org> | 2022-03-16 13:15:15 -0600 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2022-03-17 00:51:36 -0700 |
commit | 190cf1507b88d25d04148d983d72a378035b05e9 (patch) | |
tree | a0aa522b2a47f022b3b791b14e3b6902f3df29d6 /Kernel/FileSystem | |
parent | 68f75ab98e4d8a7e48de48c2497a8395b79a4ba5 (diff) | |
download | serenity-190cf1507b88d25d04148d983d72a378035b05e9.zip |
Kernel: Use default constructors/destructors
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules
"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
Diffstat (limited to 'Kernel/FileSystem')
-rw-r--r-- | Kernel/FileSystem/AnonymousFile.cpp | 4 | ||||
-rw-r--r-- | Kernel/FileSystem/BlockBasedFileSystem.cpp | 4 | ||||
-rw-r--r-- | Kernel/FileSystem/Custody.cpp | 4 | ||||
-rw-r--r-- | Kernel/FileSystem/DevPtsFS.cpp | 13 | ||||
-rw-r--r-- | Kernel/FileSystem/DevTmpFS.cpp | 24 | ||||
-rw-r--r-- | Kernel/FileSystem/Ext2FileSystem.cpp | 4 | ||||
-rw-r--r-- | Kernel/FileSystem/FIFO.cpp | 4 | ||||
-rw-r--r-- | Kernel/FileSystem/File.cpp | 9 | ||||
-rw-r--r-- | Kernel/FileSystem/FileBackedFileSystem.cpp | 4 | ||||
-rw-r--r-- | Kernel/FileSystem/ISO9660FileSystem.cpp | 8 | ||||
-rw-r--r-- | Kernel/FileSystem/InodeFile.cpp | 4 | ||||
-rw-r--r-- | Kernel/FileSystem/Plan9FileSystem.cpp | 4 | ||||
-rw-r--r-- | Kernel/FileSystem/ProcFS.cpp | 17 | ||||
-rw-r--r-- | Kernel/FileSystem/SysFS.cpp | 13 | ||||
-rw-r--r-- | Kernel/FileSystem/TmpFS.cpp | 13 | ||||
-rw-r--r-- | Kernel/FileSystem/VirtualFileSystem.cpp | 4 |
16 files changed, 32 insertions, 101 deletions
diff --git a/Kernel/FileSystem/AnonymousFile.cpp b/Kernel/FileSystem/AnonymousFile.cpp index b3e0a92b70..3e7955e972 100644 --- a/Kernel/FileSystem/AnonymousFile.cpp +++ b/Kernel/FileSystem/AnonymousFile.cpp @@ -15,9 +15,7 @@ AnonymousFile::AnonymousFile(NonnullRefPtr<Memory::AnonymousVMObject> vmobject) { } -AnonymousFile::~AnonymousFile() -{ -} +AnonymousFile::~AnonymousFile() = default; ErrorOr<Memory::Region*> AnonymousFile::mmap(Process& process, OpenFileDescription&, Memory::VirtualRange const& range, u64 offset, int prot, bool shared) { diff --git a/Kernel/FileSystem/BlockBasedFileSystem.cpp b/Kernel/FileSystem/BlockBasedFileSystem.cpp index 8e7bee709a..1325c12d48 100644 --- a/Kernel/FileSystem/BlockBasedFileSystem.cpp +++ b/Kernel/FileSystem/BlockBasedFileSystem.cpp @@ -114,9 +114,7 @@ BlockBasedFileSystem::BlockBasedFileSystem(OpenFileDescription& file_description VERIFY(file_description.file().is_seekable()); } -BlockBasedFileSystem::~BlockBasedFileSystem() -{ -} +BlockBasedFileSystem::~BlockBasedFileSystem() = default; ErrorOr<void> BlockBasedFileSystem::initialize() { diff --git a/Kernel/FileSystem/Custody.cpp b/Kernel/FileSystem/Custody.cpp index 06e68fc183..f3944b793b 100644 --- a/Kernel/FileSystem/Custody.cpp +++ b/Kernel/FileSystem/Custody.cpp @@ -47,9 +47,7 @@ Custody::Custody(Custody* parent, NonnullOwnPtr<KString> name, Inode& inode, int { } -Custody::~Custody() -{ -} +Custody::~Custody() = default; ErrorOr<NonnullOwnPtr<KString>> Custody::try_serialize_absolute_path() const { diff --git a/Kernel/FileSystem/DevPtsFS.cpp b/Kernel/FileSystem/DevPtsFS.cpp index 4eb8b0a541..d09a58862f 100644 --- a/Kernel/FileSystem/DevPtsFS.cpp +++ b/Kernel/FileSystem/DevPtsFS.cpp @@ -17,13 +17,8 @@ ErrorOr<NonnullRefPtr<DevPtsFS>> DevPtsFS::try_create() return adopt_nonnull_ref_or_enomem(new (nothrow) DevPtsFS); } -DevPtsFS::DevPtsFS() -{ -} - -DevPtsFS::~DevPtsFS() -{ -} +DevPtsFS::DevPtsFS() = default; +DevPtsFS::~DevPtsFS() = default; ErrorOr<void> DevPtsFS::initialize() { @@ -81,9 +76,7 @@ DevPtsFSInode::DevPtsFSInode(DevPtsFS& fs, InodeIndex index, SlavePTY* pty) m_pty = *pty; } -DevPtsFSInode::~DevPtsFSInode() -{ -} +DevPtsFSInode::~DevPtsFSInode() = default; ErrorOr<size_t> DevPtsFSInode::read_bytes(off_t, size_t, UserOrKernelBuffer&, OpenFileDescription*) const { diff --git a/Kernel/FileSystem/DevTmpFS.cpp b/Kernel/FileSystem/DevTmpFS.cpp index 34736caf35..151bd6d12b 100644 --- a/Kernel/FileSystem/DevTmpFS.cpp +++ b/Kernel/FileSystem/DevTmpFS.cpp @@ -16,9 +16,7 @@ ErrorOr<NonnullRefPtr<DevTmpFS>> DevTmpFS::try_create() return adopt_nonnull_ref_or_enomem(new (nothrow) DevTmpFS); } -DevTmpFS::DevTmpFS() -{ -} +DevTmpFS::DevTmpFS() = default; size_t DevTmpFS::allocate_inode_index() { @@ -28,9 +26,7 @@ size_t DevTmpFS::allocate_inode_index() return 1 + m_next_inode_index.value(); } -DevTmpFS::~DevTmpFS() -{ -} +DevTmpFS::~DevTmpFS() = default; ErrorOr<void> DevTmpFS::initialize() { @@ -167,9 +163,7 @@ StringView DevTmpFSLinkInode::name() const return m_name->view(); } -DevTmpFSLinkInode::~DevTmpFSLinkInode() -{ -} +DevTmpFSLinkInode::~DevTmpFSLinkInode() = default; DevTmpFSLinkInode::DevTmpFSLinkInode(DevTmpFS& fs, NonnullOwnPtr<KString> name) : DevTmpFSInode(fs) @@ -206,9 +200,7 @@ DevTmpFSDirectoryInode::DevTmpFSDirectoryInode(DevTmpFS& fs, NonnullOwnPtr<KStri , m_name(move(name)) { } -DevTmpFSDirectoryInode::~DevTmpFSDirectoryInode() -{ -} +DevTmpFSDirectoryInode::~DevTmpFSDirectoryInode() = default; ErrorOr<void> DevTmpFSDirectoryInode::traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const { @@ -286,9 +278,7 @@ DevTmpFSRootDirectoryInode::DevTmpFSRootDirectoryInode(DevTmpFS& fs) { m_mode = 0555; } -DevTmpFSRootDirectoryInode::~DevTmpFSRootDirectoryInode() -{ -} +DevTmpFSRootDirectoryInode::~DevTmpFSRootDirectoryInode() = default; ErrorOr<void> DevTmpFSRootDirectoryInode::chmod(mode_t) { return EPERM; @@ -306,9 +296,7 @@ DevTmpFSDeviceInode::DevTmpFSDeviceInode(DevTmpFS& fs, MajorNumber major_number, { } -DevTmpFSDeviceInode::~DevTmpFSDeviceInode() -{ -} +DevTmpFSDeviceInode::~DevTmpFSDeviceInode() = default; StringView DevTmpFSDeviceInode::name() const { diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp index 8d1e320ceb..27eb4766f0 100644 --- a/Kernel/FileSystem/Ext2FileSystem.cpp +++ b/Kernel/FileSystem/Ext2FileSystem.cpp @@ -59,9 +59,7 @@ Ext2FS::Ext2FS(OpenFileDescription& file_description) { } -Ext2FS::~Ext2FS() -{ -} +Ext2FS::~Ext2FS() = default; ErrorOr<void> Ext2FS::flush_super_block() { diff --git a/Kernel/FileSystem/FIFO.cpp b/Kernel/FileSystem/FIFO.cpp index a4edad37d9..0d0e63df2c 100644 --- a/Kernel/FileSystem/FIFO.cpp +++ b/Kernel/FileSystem/FIFO.cpp @@ -71,9 +71,7 @@ FIFO::FIFO(UserID uid, NonnullOwnPtr<DoubleBuffer> buffer) }); } -FIFO::~FIFO() -{ -} +FIFO::~FIFO() = default; void FIFO::attach(Direction direction) { diff --git a/Kernel/FileSystem/File.cpp b/Kernel/FileSystem/File.cpp index 5b44450ce0..16873b3ec3 100644 --- a/Kernel/FileSystem/File.cpp +++ b/Kernel/FileSystem/File.cpp @@ -12,13 +12,8 @@ namespace Kernel { -File::File() -{ -} - -File::~File() -{ -} +File::File() = default; +File::~File() = default; ErrorOr<NonnullRefPtr<OpenFileDescription>> File::open(int options) { diff --git a/Kernel/FileSystem/FileBackedFileSystem.cpp b/Kernel/FileSystem/FileBackedFileSystem.cpp index 44ee0a70ff..ab0c1e97e4 100644 --- a/Kernel/FileSystem/FileBackedFileSystem.cpp +++ b/Kernel/FileSystem/FileBackedFileSystem.cpp @@ -13,8 +13,6 @@ FileBackedFileSystem::FileBackedFileSystem(OpenFileDescription& file_description { } -FileBackedFileSystem::~FileBackedFileSystem() -{ -} +FileBackedFileSystem::~FileBackedFileSystem() = default; } diff --git a/Kernel/FileSystem/ISO9660FileSystem.cpp b/Kernel/FileSystem/ISO9660FileSystem.cpp index 316209e6de..ed688363ac 100644 --- a/Kernel/FileSystem/ISO9660FileSystem.cpp +++ b/Kernel/FileSystem/ISO9660FileSystem.cpp @@ -180,9 +180,7 @@ ISO9660FS::ISO9660FS(OpenFileDescription& description) m_logical_block_size = logical_sector_size; } -ISO9660FS::~ISO9660FS() -{ -} +ISO9660FS::~ISO9660FS() = default; ErrorOr<void> ISO9660FS::initialize() { @@ -553,9 +551,7 @@ ISO9660Inode::ISO9660Inode(ISO9660FS& fs, ISO::DirectoryRecordHeader const& reco create_metadata(); } -ISO9660Inode::~ISO9660Inode() -{ -} +ISO9660Inode::~ISO9660Inode() = default; ErrorOr<NonnullRefPtr<ISO9660Inode>> ISO9660Inode::try_create_from_directory_record(ISO9660FS& fs, ISO::DirectoryRecordHeader const& record, StringView name) { diff --git a/Kernel/FileSystem/InodeFile.cpp b/Kernel/FileSystem/InodeFile.cpp index 6ee7a5ac8e..eeccf5fcae 100644 --- a/Kernel/FileSystem/InodeFile.cpp +++ b/Kernel/FileSystem/InodeFile.cpp @@ -22,9 +22,7 @@ InodeFile::InodeFile(NonnullRefPtr<Inode>&& inode) { } -InodeFile::~InodeFile() -{ -} +InodeFile::~InodeFile() = default; ErrorOr<size_t> InodeFile::read(OpenFileDescription& description, u64 offset, UserOrKernelBuffer& buffer, size_t count) { diff --git a/Kernel/FileSystem/Plan9FileSystem.cpp b/Kernel/FileSystem/Plan9FileSystem.cpp index 5f447198b7..a4f34c3437 100644 --- a/Kernel/FileSystem/Plan9FileSystem.cpp +++ b/Kernel/FileSystem/Plan9FileSystem.cpp @@ -399,9 +399,7 @@ Plan9FS::ReceiveCompletion::ReceiveCompletion(u16 tag) { } -Plan9FS::ReceiveCompletion::~ReceiveCompletion() -{ -} +Plan9FS::ReceiveCompletion::~ReceiveCompletion() = default; bool Plan9FS::Blocker::unblock(u16 tag) { diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp index 6b2f0715ff..01e25b758b 100644 --- a/Kernel/FileSystem/ProcFS.cpp +++ b/Kernel/FileSystem/ProcFS.cpp @@ -42,13 +42,8 @@ ErrorOr<NonnullRefPtr<ProcFS>> ProcFS::try_create() return adopt_nonnull_ref_or_enomem(new (nothrow) ProcFS()); } -ProcFS::ProcFS() -{ -} - -ProcFS::~ProcFS() -{ -} +ProcFS::ProcFS() = default; +ProcFS::~ProcFS() = default; ErrorOr<void> ProcFS::initialize() { @@ -66,9 +61,7 @@ ProcFSInode::ProcFSInode(const ProcFS& fs, InodeIndex index) { } -ProcFSInode::~ProcFSInode() -{ -} +ProcFSInode::~ProcFSInode() = default; ErrorOr<void> ProcFSInode::flush_metadata() { @@ -185,9 +178,7 @@ ProcFSDirectoryInode::ProcFSDirectoryInode(const ProcFS& fs, const ProcFSExposed { } -ProcFSDirectoryInode::~ProcFSDirectoryInode() -{ -} +ProcFSDirectoryInode::~ProcFSDirectoryInode() = default; InodeMetadata ProcFSDirectoryInode::metadata() const { MutexLocker locker(m_inode_lock); diff --git a/Kernel/FileSystem/SysFS.cpp b/Kernel/FileSystem/SysFS.cpp index 7395f0addb..d3ac479ffb 100644 --- a/Kernel/FileSystem/SysFS.cpp +++ b/Kernel/FileSystem/SysFS.cpp @@ -73,13 +73,8 @@ ErrorOr<NonnullRefPtr<SysFS>> SysFS::try_create() return adopt_nonnull_ref_or_enomem(new (nothrow) SysFS); } -SysFS::SysFS() -{ -} - -SysFS::~SysFS() -{ -} +SysFS::SysFS() = default; +SysFS::~SysFS() = default; ErrorOr<void> SysFS::initialize() { @@ -202,9 +197,7 @@ SysFSDirectoryInode::SysFSDirectoryInode(SysFS const& fs, SysFSComponent const& { } -SysFSDirectoryInode::~SysFSDirectoryInode() -{ -} +SysFSDirectoryInode::~SysFSDirectoryInode() = default; InodeMetadata SysFSDirectoryInode::metadata() const { diff --git a/Kernel/FileSystem/TmpFS.cpp b/Kernel/FileSystem/TmpFS.cpp index aac29ad936..0b44c20d68 100644 --- a/Kernel/FileSystem/TmpFS.cpp +++ b/Kernel/FileSystem/TmpFS.cpp @@ -15,13 +15,8 @@ ErrorOr<NonnullRefPtr<TmpFS>> TmpFS::try_create() return adopt_nonnull_ref_or_enomem(new (nothrow) TmpFS); } -TmpFS::TmpFS() -{ -} - -TmpFS::~TmpFS() -{ -} +TmpFS::TmpFS() = default; +TmpFS::~TmpFS() = default; ErrorOr<void> TmpFS::initialize() { @@ -50,9 +45,7 @@ TmpFSInode::TmpFSInode(TmpFS& fs, const InodeMetadata& metadata, WeakPtr<TmpFSIn m_metadata.inode = identifier(); } -TmpFSInode::~TmpFSInode() -{ -} +TmpFSInode::~TmpFSInode() = default; ErrorOr<NonnullRefPtr<TmpFSInode>> TmpFSInode::try_create(TmpFS& fs, InodeMetadata const& metadata, WeakPtr<TmpFSInode> parent) { diff --git a/Kernel/FileSystem/VirtualFileSystem.cpp b/Kernel/FileSystem/VirtualFileSystem.cpp index 46a9c6209c..e2c464a86d 100644 --- a/Kernel/FileSystem/VirtualFileSystem.cpp +++ b/Kernel/FileSystem/VirtualFileSystem.cpp @@ -40,9 +40,7 @@ UNMAP_AFTER_INIT VirtualFileSystem::VirtualFileSystem() { } -UNMAP_AFTER_INIT VirtualFileSystem::~VirtualFileSystem() -{ -} +UNMAP_AFTER_INIT VirtualFileSystem::~VirtualFileSystem() = default; InodeIdentifier VirtualFileSystem::root_inode_id() const { |