Commit 01188a27 authored by Dominik Charousset's avatar Dominik Charousset

Integrate review feedback

parent e8064869
......@@ -19,9 +19,11 @@ namespace caf::test {
/// A registry for our factories.
class CAF_TEST_EXPORT registry {
public:
constexpr registry() noexcept : head_(nullptr), tail_(nullptr) {
// nop
}
constexpr registry() noexcept = default;
registry(const registry&) = delete;
registry& operator=(const registry&) = delete;
~registry();
......@@ -52,8 +54,8 @@ private:
static registry& instance();
factory* head_;
factory* tail_;
factory* head_ = nullptr;
factory* tail_ = nullptr;
};
} // namespace caf::test
......@@ -10,11 +10,10 @@
namespace caf::test {
registry::~registry() {
auto ptr = head_;
while (ptr != nullptr) {
auto next = ptr->next_;
delete ptr;
ptr = next;
while (head_ != nullptr) {
auto next = head_->next_;
delete head_;
head_ = next;
}
}
......@@ -32,13 +31,11 @@ registry::suites_map registry::suites() {
}
ptrdiff_t registry::add(factory* new_factory) {
if (head_ == nullptr) {
if (head_ == nullptr)
head_ = new_factory;
tail_ = head_;
} else {
else
tail_->next_ = new_factory;
tail_ = new_factory;
}
tail_ = new_factory;
return reinterpret_cast<ptrdiff_t>(new_factory);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment