summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem/DevPtsFS.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-06-12 21:07:52 +0200
committerAndreas Kling <kling@serenityos.org>2020-06-12 21:28:55 +0200
commitfdfda6dec20101013bb33633e657f06ef2a1ea96 (patch)
tree2157f8281cd9bc33a6984455c4831c397d2bd30c /Kernel/FileSystem/DevPtsFS.cpp
parent15f4043a7a80f52c0fa05c4e69771e758464cd20 (diff)
downloadserenity-fdfda6dec20101013bb33633e657f06ef2a1ea96.zip
AK: Make string-to-number conversion helpers return Optional
Get rid of the weird old signature: - int StringType::to_int(bool& ok) const And replace it with sensible new signature: - Optional<int> StringType::to_int() const
Diffstat (limited to 'Kernel/FileSystem/DevPtsFS.cpp')
-rw-r--r--Kernel/FileSystem/DevPtsFS.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/Kernel/FileSystem/DevPtsFS.cpp b/Kernel/FileSystem/DevPtsFS.cpp
index cf0237584e..4b86dc6a1d 100644
--- a/Kernel/FileSystem/DevPtsFS.cpp
+++ b/Kernel/FileSystem/DevPtsFS.cpp
@@ -177,10 +177,9 @@ RefPtr<Inode> DevPtsFSInode::lookup(StringView name)
if (name == "." || name == "..")
return fs().get_inode(identifier());
- bool ok;
- unsigned pty_index = name.to_uint(ok);
- if (ok && ptys->contains(pty_index)) {
- return fs().get_inode({ fsid(), pty_index_to_inode_index(pty_index) });
+ auto pty_index = name.to_uint();
+ if (pty_index.has_value() && ptys->contains(pty_index.value())) {
+ return fs().get_inode({ fsid(), pty_index_to_inode_index(pty_index.value()) });
}
return {};