summaryrefslogtreecommitdiff
path: root/Kernel/Thread.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-01-27 21:01:45 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-27 21:14:42 +0100
commite67402c7027f13fcc03d61f88725470e4c66e820 (patch)
tree673d40ced3c4dec8da64200ee21c4c8398d6fcb6 /Kernel/Thread.cpp
parent67bc5e0bbdcf313b20b32069a5e9b9806f8bd790 (diff)
downloadserenity-e67402c7027f13fcc03d61f88725470e4c66e820.zip
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.
Diffstat (limited to 'Kernel/Thread.cpp')
-rw-r--r--Kernel/Thread.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp
index 7bef932346..b2b86979fe 100644
--- a/Kernel/Thread.cpp
+++ b/Kernel/Thread.cpp
@@ -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();