summaryrefslogtreecommitdiff
path: root/sql/wsrep_mutex.h
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-02-23 07:18:00 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2022-02-23 07:18:00 +0200
commit0b849a441afaa5f4ce1ad1af877363d7b5c4a1e2 (patch)
tree3182051655a273f906ea7d0fd27d3dae25a19341 /sql/wsrep_mutex.h
parentb5fe7ab8412d63b784ab318f11506954639f1d3c (diff)
downloadmariadb-git-0b849a441afaa5f4ce1ad1af877363d7b5c4a1e2.tar.gz
WSREP: Fix GCC 12.0.1 -Wuninitialized
GCC 12 complains if a reference to an uninitialized object is being passed to a constructor. The mysql_mutex_t, mysql_cond_t would be initialized in the constructor body, which is executed after the initializer list. There is no problem passing a pointer instead of a reference. The wrapper classes do not dereference the pointers in the constructor or destructor, so there does not appear to be any correctness issue.
Diffstat (limited to 'sql/wsrep_mutex.h')
-rw-r--r--sql/wsrep_mutex.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/sql/wsrep_mutex.h b/sql/wsrep_mutex.h
index 3454b44e0ec..f396c1be331 100644
--- a/sql/wsrep_mutex.h
+++ b/sql/wsrep_mutex.h
@@ -25,26 +25,26 @@
class Wsrep_mutex : public wsrep::mutex
{
public:
- Wsrep_mutex(mysql_mutex_t& mutex)
+ Wsrep_mutex(mysql_mutex_t* mutex)
: m_mutex(mutex)
{ }
void lock()
{
- mysql_mutex_lock(&m_mutex);
+ mysql_mutex_lock(m_mutex);
}
void unlock()
{
- mysql_mutex_unlock(&m_mutex);
+ mysql_mutex_unlock(m_mutex);
}
void* native()
{
- return &m_mutex;
+ return m_mutex;
}
private:
- mysql_mutex_t& m_mutex;
+ mysql_mutex_t* m_mutex;
};
#endif /* WSREP_MUTEX_H */