1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 13:35:07 +00:00

Kernel: Simplify OOM handling in ISO9660FileSystem

This commit is contained in:
sin-ack 2021-08-15 08:33:12 +00:00 committed by Andreas Kling
parent 8d90ecb280
commit 61c0e3ca92
2 changed files with 3 additions and 15 deletions

View file

@ -184,11 +184,7 @@ private:
KResultOr<NonnullRefPtr<ISO9660FS>> ISO9660FS::try_create(FileDescription& description)
{
auto result = adopt_ref_if_nonnull(new (nothrow) ISO9660FS(description));
if (!result) {
return ENOMEM;
}
return result.release_nonnull();
return adopt_nonnull_ref_or_enomem(new (nothrow) ISO9660FS(description));
}
ISO9660FS::ISO9660FS(FileDescription& description)
@ -632,11 +628,7 @@ ISO9660Inode::~ISO9660Inode()
KResultOr<NonnullRefPtr<ISO9660Inode>> ISO9660Inode::try_create_from_directory_record(ISO9660FS& fs, ISO::DirectoryRecordHeader const& record, StringView const& name)
{
auto result = adopt_ref_if_nonnull(new (nothrow) ISO9660Inode(fs, record, name));
if (!result) {
return ENOMEM;
}
return result.release_nonnull();
return adopt_nonnull_ref_or_enomem(new (nothrow) ISO9660Inode(fs, record, name));
}
void ISO9660Inode::create_metadata()