kernel/handle_table: Make local variables as const where applicable
Makes immutable state explicit.
This commit is contained in:
parent
5167d1577d
commit
d29f9e9709
|
@ -79,10 +79,11 @@ ResultVal<Handle> HandleTable::Duplicate(Handle handle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode HandleTable::Close(Handle handle) {
|
ResultCode HandleTable::Close(Handle handle) {
|
||||||
if (!IsValid(handle))
|
if (!IsValid(handle)) {
|
||||||
return ERR_INVALID_HANDLE;
|
return ERR_INVALID_HANDLE;
|
||||||
|
}
|
||||||
|
|
||||||
u16 slot = GetSlot(handle);
|
const u16 slot = GetSlot(handle);
|
||||||
|
|
||||||
objects[slot] = nullptr;
|
objects[slot] = nullptr;
|
||||||
|
|
||||||
|
@ -92,8 +93,8 @@ ResultCode HandleTable::Close(Handle handle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HandleTable::IsValid(Handle handle) const {
|
bool HandleTable::IsValid(Handle handle) const {
|
||||||
std::size_t slot = GetSlot(handle);
|
const std::size_t slot = GetSlot(handle);
|
||||||
u16 generation = GetGeneration(handle);
|
const u16 generation = GetGeneration(handle);
|
||||||
|
|
||||||
return slot < table_size && objects[slot] != nullptr && generations[slot] == generation;
|
return slot < table_size && objects[slot] != nullptr && generations[slot] == generation;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue