From d29f9e9709b3cab6448b43f00f4f0204680ceee5 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 25 Feb 2019 11:06:00 -0500 Subject: kernel/handle_table: Make local variables as const where applicable Makes immutable state explicit. --- src/core/hle/kernel/handle_table.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/core') 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 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; } -- cgit v1.2.3