diff options
| author | 2019-02-25 11:06:00 -0500 | |
|---|---|---|
| committer | 2019-02-25 11:12:38 -0500 | |
| commit | d29f9e9709b3cab6448b43f00f4f0204680ceee5 (patch) | |
| tree | 2864fea5733fceb2e2eb7af95af688b1cd79c865 | |
| parent | kernel/handle_table: Allow process capabilities to limit the handle table size (diff) | |
| download | yuzu-d29f9e9709b3cab6448b43f00f4f0204680ceee5.tar.gz yuzu-d29f9e9709b3cab6448b43f00f4f0204680ceee5.tar.xz yuzu-d29f9e9709b3cab6448b43f00f4f0204680ceee5.zip | |
kernel/handle_table: Make local variables as const where applicable
Makes immutable state explicit.
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/kernel/handle_table.cpp | 9 |
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) { | |||
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | ResultCode HandleTable::Close(Handle handle) { | 81 | ResultCode HandleTable::Close(Handle handle) { |
| 82 | if (!IsValid(handle)) | 82 | if (!IsValid(handle)) { |
| 83 | return ERR_INVALID_HANDLE; | 83 | return ERR_INVALID_HANDLE; |
| 84 | } | ||
| 84 | 85 | ||
| 85 | u16 slot = GetSlot(handle); | 86 | const u16 slot = GetSlot(handle); |
| 86 | 87 | ||
| 87 | objects[slot] = nullptr; | 88 | objects[slot] = nullptr; |
| 88 | 89 | ||
| @@ -92,8 +93,8 @@ ResultCode HandleTable::Close(Handle handle) { | |||
| 92 | } | 93 | } |
| 93 | 94 | ||
| 94 | bool HandleTable::IsValid(Handle handle) const { | 95 | bool HandleTable::IsValid(Handle handle) const { |
| 95 | std::size_t slot = GetSlot(handle); | 96 | const std::size_t slot = GetSlot(handle); |
| 96 | u16 generation = GetGeneration(handle); | 97 | const u16 generation = GetGeneration(handle); |
| 97 | 98 | ||
| 98 | return slot < table_size && objects[slot] != nullptr && generations[slot] == generation; | 99 | return slot < table_size && objects[slot] != nullptr && generations[slot] == generation; |
| 99 | } | 100 | } |