mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
Kernel: Fix adopt_ref_if_nonnull(new T).release_nonnull() pattern
This does the exact thing as `adopt_ref`, which is a recent addition to AK. Note that pointers returned by a bare new (without `nothrow`) are guaranteed not to return null, so they can safely be converted into references.
This commit is contained in:
committed by
Ali Mohammad Pur
parent
9b1157924b
commit
2a5d9a6944
@@ -17,7 +17,7 @@ namespace Kernel {
|
||||
|
||||
UNMAP_AFTER_INIT NonnullRefPtr<MemoryDevice> MemoryDevice::must_create()
|
||||
{
|
||||
return adopt_ref_if_nonnull(new MemoryDevice).release_nonnull();
|
||||
return adopt_ref(*new MemoryDevice);
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT MemoryDevice::MemoryDevice()
|
||||
|
||||
Reference in New Issue
Block a user