mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-28 12:18:25 +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:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user