summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2019-02-25 17:06:00 +0100
committerLioncash <mathew1800@gmail.com>2019-02-25 17:12:38 +0100
commitd29f9e9709b3cab6448b43f00f4f0204680ceee5 (patch)
tree2864fea5733fceb2e2eb7af95af688b1cd79c865
parentkernel/handle_table: Allow process capabilities to limit the handle table size (diff)
downloadyuzu-d29f9e9709b3cab6448b43f00f4f0204680ceee5.tar
yuzu-d29f9e9709b3cab6448b43f00f4f0204680ceee5.tar.gz
yuzu-d29f9e9709b3cab6448b43f00f4f0204680ceee5.tar.bz2
yuzu-d29f9e9709b3cab6448b43f00f4f0204680ceee5.tar.lz
yuzu-d29f9e9709b3cab6448b43f00f4f0204680ceee5.tar.xz
yuzu-d29f9e9709b3cab6448b43f00f4f0204680ceee5.tar.zst
yuzu-d29f9e9709b3cab6448b43f00f4f0204680ceee5.zip
-rw-r--r--src/core/hle/kernel/handle_table.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core/hle/kernel/handle_table.cpp b/src/core/hle/kernel/handle_table.cpp
index 84a9ca7fc..bdfaa977f 100644
--- a/src/core/hle/kernel/handle_table.cpp
+++ b/src/core/hle/kernel/handle_table.cpp
@@ -79,10 +79,11 @@ ResultVal<Handle> HandleTable::Duplicate(Handle handle) {
}
ResultCode HandleTable::Close(Handle handle) {
- if (!IsValid(handle))
+ if (!IsValid(handle)) {
return ERR_INVALID_HANDLE;
+ }
- u16 slot = GetSlot(handle);
+ const u16 slot = GetSlot(handle);
objects[slot] = nullptr;
@@ -92,8 +93,8 @@ ResultCode HandleTable::Close(Handle handle) {
}
bool HandleTable::IsValid(Handle handle) const {
- std::size_t slot = GetSlot(handle);
- u16 generation = GetGeneration(handle);
+ const std::size_t slot = GetSlot(handle);
+ const u16 generation = GetGeneration(handle);
return slot < table_size && objects[slot] != nullptr && generations[slot] == generation;
}