aboutsummaryrefslogtreecommitdiff
path: root/src/zmq/zmqnotificationinterface.cpp
diff options
context:
space:
mode:
authorDaniel Kraft <d@domob.eu>2018-07-17 12:36:22 +0200
committerDaniel Kraft <d@domob.eu>2020-09-07 10:55:55 +0200
commit7f2ad1b9acef4ccc1b3e1a9f551416235d95cbfd (patch)
tree196d1e6dcae168a705e4af1739473485bd6794a3 /src/zmq/zmqnotificationinterface.cpp
parentb93b9d54569145bfcec6cee10968284fe05fe254 (diff)
downloadbitcoin-7f2ad1b9acef4ccc1b3e1a9f551416235d95cbfd.tar.xz
Use std::unique_ptr for CZMQNotifierFactory.
Instead of returning a raw pointer from CZMQNotifierFactory and implicitly requiring the caller to know that it has to take ownership, return a std::unique_ptr to make this explicit. This also changes the typedef for CZMQNotifierFactory to use the new C++11 using syntax, which makes it (a little) less cryptic.
Diffstat (limited to 'src/zmq/zmqnotificationinterface.cpp')
-rw-r--r--src/zmq/zmqnotificationinterface.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/zmq/zmqnotificationinterface.cpp b/src/zmq/zmqnotificationinterface.cpp
index 449651e65f..9e9acdc568 100644
--- a/src/zmq/zmqnotificationinterface.cpp
+++ b/src/zmq/zmqnotificationinterface.cpp
@@ -45,13 +45,13 @@ CZMQNotificationInterface* CZMQNotificationInterface::Create()
std::string arg("-zmq" + entry.first);
if (gArgs.IsArgSet(arg))
{
- CZMQNotifierFactory factory = entry.second;
- std::string address = gArgs.GetArg(arg, "");
- CZMQAbstractNotifier *notifier = factory();
+ const auto& factory = entry.second;
+ const std::string address = gArgs.GetArg(arg, "");
+ std::unique_ptr<CZMQAbstractNotifier> notifier = factory();
notifier->SetType(entry.first);
notifier->SetAddress(address);
notifier->SetOutboundMessageHighWaterMark(static_cast<int>(gArgs.GetArg(arg + "hwm", CZMQAbstractNotifier::DEFAULT_ZMQ_SNDHWM)));
- notifiers.emplace_back(notifier);
+ notifiers.push_back(std::move(notifier));
}
}