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:
parent
89e3bc8d56
commit
e73eed247e
19 changed files with 190 additions and 160 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue