mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-30 07:23:07 +03:00
Define undefined id and gtid as const static member variables.
Use default seqno and id constructors in default gtid ctor instead of calls to static undefined to initialize.
This commit is contained in:
@ -31,8 +31,8 @@ namespace wsrep
|
||||
{
|
||||
public:
|
||||
gtid()
|
||||
: id_(wsrep::id::undefined())
|
||||
, seqno_(wsrep::seqno::undefined())
|
||||
: id_()
|
||||
, seqno_()
|
||||
{ }
|
||||
gtid(const wsrep::id& id, wsrep::seqno seqno)
|
||||
: id_(id)
|
||||
@ -44,13 +44,12 @@ namespace wsrep
|
||||
{
|
||||
return (seqno_.is_undefined() && id_.is_undefined());
|
||||
}
|
||||
static wsrep::gtid undefined()
|
||||
static const wsrep::gtid& undefined()
|
||||
{
|
||||
static const wsrep::gtid ret(wsrep::id::undefined(),
|
||||
wsrep::seqno::undefined());
|
||||
return ret;
|
||||
return undefined_;
|
||||
}
|
||||
private:
|
||||
static const wsrep::gtid undefined_;
|
||||
wsrep::id id_;
|
||||
wsrep::seqno seqno_;
|
||||
};
|
||||
|
@ -90,10 +90,10 @@ namespace wsrep
|
||||
|
||||
static const wsrep::id& undefined()
|
||||
{
|
||||
static wsrep::id ret = wsrep::id();
|
||||
return ret;
|
||||
return undefined_;
|
||||
}
|
||||
private:
|
||||
static const wsrep::id undefined_;
|
||||
unsigned char data_[16];
|
||||
};
|
||||
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
const wsrep::gtid wsrep::gtid::undefined_ = wsrep::gtid();
|
||||
|
||||
std::ostream& wsrep::operator<<(std::ostream& os, const wsrep::gtid& gtid)
|
||||
{
|
||||
return (os << gtid.id() << ":" << gtid.seqno());
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
|
||||
const wsrep::id wsrep::id::undefined_ = wsrep::id();
|
||||
|
||||
wsrep::id::id(const std::string& str)
|
||||
: data_()
|
||||
{
|
||||
|
Reference in New Issue
Block a user