mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 18:32:28 -05:00
Kernel: Simplify OOM handling in ISO9660FileSystem
This commit is contained in:
parent
8d90ecb280
commit
61c0e3ca92
2 changed files with 3 additions and 15 deletions
|
@ -184,11 +184,7 @@ private:
|
||||||
|
|
||||||
KResultOr<NonnullRefPtr<ISO9660FS>> ISO9660FS::try_create(FileDescription& description)
|
KResultOr<NonnullRefPtr<ISO9660FS>> ISO9660FS::try_create(FileDescription& description)
|
||||||
{
|
{
|
||||||
auto result = adopt_ref_if_nonnull(new (nothrow) ISO9660FS(description));
|
return adopt_nonnull_ref_or_enomem(new (nothrow) ISO9660FS(description));
|
||||||
if (!result) {
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
return result.release_nonnull();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ISO9660FS::ISO9660FS(FileDescription& 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)
|
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));
|
return adopt_nonnull_ref_or_enomem(new (nothrow) ISO9660Inode(fs, record, name));
|
||||||
if (!result) {
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
return result.release_nonnull();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ISO9660Inode::create_metadata()
|
void ISO9660Inode::create_metadata()
|
||||||
|
|
|
@ -293,11 +293,7 @@ public:
|
||||||
|
|
||||||
static KResultOr<NonnullRefPtr<DirectoryEntry>> try_create(u32 extent, u32 length, OwnPtr<KBuffer> blocks)
|
static KResultOr<NonnullRefPtr<DirectoryEntry>> try_create(u32 extent, u32 length, OwnPtr<KBuffer> blocks)
|
||||||
{
|
{
|
||||||
auto result = adopt_ref_if_nonnull(new (nothrow) DirectoryEntry(extent, length, move(blocks)));
|
return adopt_nonnull_ref_or_enomem(new (nothrow) DirectoryEntry(extent, length, move(blocks)));
|
||||||
if (!result) {
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
return result.release_nonnull();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Add table
Reference in a new issue