1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-10 18:51:05 +00:00

Apply some refactoring/cleanup to mainly util functions

This commit is contained in:
sfan5 2025-03-26 19:08:31 +01:00
parent 89e3bc8d56
commit e73eed247e
19 changed files with 190 additions and 160 deletions

View file

@ -362,11 +362,10 @@ public:
// This conditional block was converted from a ternary to ensure no
// temporary values are created in evaluating the return expression,
// which could cause a dangling reference.
if (it != m_values.end()) {
if (it != m_values.end())
return it->second;
} else {
else
return null_value;
}
}
void put(const K &key, const V &value) {
@ -430,7 +429,7 @@ public:
return !!take(key);
}
// Warning: not constant-time!
/// @warning not constant-time!
size_t size() const {
if (m_iterating) {
// This is by no means impossible to determine, it's just annoying
@ -446,7 +445,7 @@ public:
return n;
}
// Warning: not constant-time!
/// @warning not constant-time!
bool empty() const {
if (m_iterating)
return false; // maybe