mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-17 17:08:39 +00:00
Fix various copy instead of const ref reported by cppcheck (part 3) (#5616)
* Also remove 2 non declared but defined functions * Make some functions around const ref changes const
This commit is contained in:
parent
f3fe62a0bf
commit
f98bbe193e
25 changed files with 182 additions and 182 deletions
|
@ -29,9 +29,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "container.h"
|
||||
|
||||
template<typename T>
|
||||
class MutexedVariable {
|
||||
class MutexedVariable
|
||||
{
|
||||
public:
|
||||
MutexedVariable(T value):
|
||||
MutexedVariable(const T &value):
|
||||
m_value(value)
|
||||
{}
|
||||
|
||||
|
@ -41,21 +42,14 @@ public:
|
|||
return m_value;
|
||||
}
|
||||
|
||||
void set(T value)
|
||||
void set(const T &value)
|
||||
{
|
||||
MutexAutoLock lock(m_mutex);
|
||||
m_value = value;
|
||||
}
|
||||
|
||||
// You'll want to grab this in a SharedPtr
|
||||
MutexAutoLock *getLock()
|
||||
{
|
||||
return new MutexAutoLock(m_mutex);
|
||||
}
|
||||
|
||||
// You pretty surely want to grab the lock when accessing this
|
||||
T m_value;
|
||||
|
||||
private:
|
||||
Mutex m_mutex;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue