Skip to content

Commit a4cb2a9

Browse files
committed
Move nullptr initializers to class declaration
1 parent 82bb2cb commit a4cb2a9

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

media-proxy/include/mesh/concurrency.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ class Context {
5050
Context(Context& parent);
5151
Context(Context& parent, std::chrono::milliseconds timeout_ms);
5252

53-
Context *parent;
54-
thread::Channel<bool> *ch;
53+
Context *parent = nullptr;
54+
thread::Channel<bool> *ch = nullptr;
5555
std::future<void> async_cb;
5656
std::chrono::milliseconds timeout_ms;
57-
std::unique_ptr<std::stop_callback<std::function<void()>>> cb;
57+
std::unique_ptr<std::stop_callback<std::function<void()>>> cb = nullptr;
5858

5959
friend Context& Background();
6060
friend class WithCancel;

media-proxy/src/mesh/concurrency.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ namespace mesh {
1212
namespace context {
1313

1414
Context::Context() : ss(std::stop_source()),
15-
parent(nullptr),
16-
cb(nullptr),
17-
ch(nullptr),
1815
timeout_ms(std::chrono::milliseconds(0))
1916
{
2017
}
@@ -55,7 +52,7 @@ Context& Context::operator=(Context&& other) noexcept {
5552
ss = std::stop_source();
5653
parent = other.parent;
5754

58-
if(parent){
55+
if (parent) {
5956
cb = std::make_unique<std::stop_callback<std::function<void()>>>(
6057
parent->ss.get_token(), [this] { cancel(); }
6158
);

0 commit comments

Comments
 (0)