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

Kernel: Remove Range "valid" state and use Optional<Range> instead

It's easier to understand VM ranges if they are always valid. We can
simply use an empty Optional<Range> to encode absence when needed.
This commit is contained in:
Andreas Kling 2021-01-27 21:01:45 +01:00
parent 67bc5e0bbd
commit e67402c702
8 changed files with 39 additions and 37 deletions

View file

@ -1059,10 +1059,10 @@ KResult Thread::make_thread_specific_region(Badge<Process>)
return KSuccess;
auto range = process().allocate_range({}, thread_specific_region_size());
if (!range.is_valid())
if (!range.has_value())
return ENOMEM;
auto region_or_error = process().allocate_region(range, "Thread-specific", PROT_READ | PROT_WRITE);
auto region_or_error = process().allocate_region(range.value(), "Thread-specific", PROT_READ | PROT_WRITE);
if (region_or_error.is_error())
return region_or_error.error();