mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-28 20:02:00 +03:00
Removing assert() calls from public headers
Removed calls to assert() from public headers to have full control when assertions are enabled in wsrep-lib code regardless of parent project build configuration. Moved methods containing assertions and non-trivial code from headers into compilation units.
This commit is contained in:
@ -22,9 +22,11 @@
|
||||
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
namespace wsrep
|
||||
{
|
||||
class key;
|
||||
class sr_key_set
|
||||
{
|
||||
public:
|
||||
@ -33,24 +35,9 @@ namespace wsrep
|
||||
sr_key_set()
|
||||
: root_()
|
||||
{ }
|
||||
|
||||
void insert(const wsrep::key& key)
|
||||
{
|
||||
assert(key.size() >= 2);
|
||||
if (key.size() < 2)
|
||||
{
|
||||
throw wsrep::runtime_error("Invalid key size");
|
||||
}
|
||||
|
||||
root_[std::string(
|
||||
static_cast<const char*>(key.key_parts()[0].data()),
|
||||
key.key_parts()[0].size())].insert(
|
||||
std::string(static_cast<const char*>(key.key_parts()[1].data()),
|
||||
key.key_parts()[1].size()));
|
||||
}
|
||||
|
||||
void insert(const wsrep::key& key);
|
||||
const branch_type& root() const { return root_; }
|
||||
void clear() { root_.clear(); }
|
||||
void clear();
|
||||
bool empty() const { return root_.empty(); }
|
||||
private:
|
||||
branch_type root_;
|
||||
|
Reference in New Issue
Block a user