1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-28 21:22:08 +00:00

AK: Make Vector::try_* functions return ErrorOr<void>

Instead of signalling allocation failure with a bool return value
(false), we now use ErrorOr<void> and return ENOMEM as appropriate.
This allows us to use TRY() and MUST() with Vector. :^)
This commit is contained in:
Andreas Kling 2021-11-10 11:55:37 +01:00
parent cd49f30bea
commit 88b6428c25
16 changed files with 98 additions and 152 deletions

View file

@ -110,8 +110,7 @@ ErrorOr<void> AddressSpace::unmap_mmap_range(VirtualAddress addr, size_t size)
// Otherwise, split the regions and collect them for future mapping.
auto split_regions = TRY(try_split_region_around_range(*region, range_to_unmap));
if (new_regions.try_extend(split_regions))
return ENOMEM;
TRY(new_regions.try_extend(split_regions));
}
// Give back any unwanted VM to the range allocator.