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

Integrate review feedback

parent e8064869
...@@ -19,9 +19,11 @@ namespace caf::test { ...@@ -19,9 +19,11 @@ namespace caf::test {
/// A registry for our factories. /// A registry for our factories.
class CAF_TEST_EXPORT registry { class CAF_TEST_EXPORT registry {
public: public:
constexpr registry() noexcept : head_(nullptr), tail_(nullptr) { constexpr registry() noexcept = default;
// nop
} registry(const registry&) = delete;
registry& operator=(const registry&) = delete;
~registry(); ~registry();
...@@ -52,8 +54,8 @@ private: ...@@ -52,8 +54,8 @@ private:
static registry& instance(); static registry& instance();
factory* head_; factory* head_ = nullptr;
factory* tail_; factory* tail_ = nullptr;
}; };
} // namespace caf::test } // namespace caf::test
...@@ -10,11 +10,10 @@ ...@@ -10,11 +10,10 @@
namespace caf::test { namespace caf::test {
registry::~registry() { registry::~registry() {
auto ptr = head_; while (head_ != nullptr) {
while (ptr != nullptr) { auto next = head_->next_;
auto next = ptr->next_; delete head_;
delete ptr; head_ = next;
ptr = next;
} }
} }
...@@ -32,13 +31,11 @@ registry::suites_map registry::suites() { ...@@ -32,13 +31,11 @@ registry::suites_map registry::suites() {
} }
ptrdiff_t registry::add(factory* new_factory) { ptrdiff_t registry::add(factory* new_factory) {
if (head_ == nullptr) { if (head_ == nullptr)
head_ = new_factory; head_ = new_factory;
tail_ = head_; else
} else {
tail_->next_ = new_factory; tail_->next_ = new_factory;
tail_ = new_factory; tail_ = new_factory;
}
return reinterpret_cast<ptrdiff_t>(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