diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-09-15 11:37:05 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-09-15 11:37:05 +0200 |
commit | 51a39bcba919ba26d5abfc818d8db347f19fbace (patch) | |
tree | 34910e6544681541d15dda1f6bc78e1f1165aecb /messagebus | |
parent | 9e7c9a50c8d11d3e1cc5e62f7ae008b8a13e5276 (diff) |
NULL -> nullptr
Diffstat (limited to 'messagebus')
18 files changed, 71 insertions, 71 deletions
diff --git a/messagebus/src/vespa/messagebus/callstack.cpp b/messagebus/src/vespa/messagebus/callstack.cpp index 0ab8658d53f..b7179e14cad 100644 --- a/messagebus/src/vespa/messagebus/callstack.cpp +++ b/messagebus/src/vespa/messagebus/callstack.cpp @@ -13,7 +13,7 @@ CallStack::discard() { while (!_stack.empty()) { const Frame &frame = _stack.back(); - if (frame.discardHandler != NULL) { + if (frame.discardHandler != nullptr) { frame.discardHandler->handleDiscard(frame.ctx); } _stack.pop_back(); diff --git a/messagebus/src/vespa/messagebus/callstack.h b/messagebus/src/vespa/messagebus/callstack.h index 68da598e796..0f9d8c93b29 100644 --- a/messagebus/src/vespa/messagebus/callstack.h +++ b/messagebus/src/vespa/messagebus/callstack.h @@ -72,7 +72,7 @@ public: * @param ctx The context to store. * @param discardHandler The handler for discarded messages. **/ - void push(IReplyHandler &replyHandler, Context ctx, IDiscardHandler *discardHandler = NULL) { + void push(IReplyHandler &replyHandler, Context ctx, IDiscardHandler *discardHandler = nullptr) { _stack.emplace_back(&replyHandler, discardHandler, ctx); } diff --git a/messagebus/src/vespa/messagebus/destinationsessionparams.cpp b/messagebus/src/vespa/messagebus/destinationsessionparams.cpp index 3959666e718..ecbc036ffed 100644 --- a/messagebus/src/vespa/messagebus/destinationsessionparams.cpp +++ b/messagebus/src/vespa/messagebus/destinationsessionparams.cpp @@ -6,7 +6,7 @@ namespace mbus { DestinationSessionParams::DestinationSessionParams() : _name("destination"), _broadcastName(true), - _handler(NULL) + _handler(nullptr) { } } // namespace mbus diff --git a/messagebus/src/vespa/messagebus/messagebus.cpp b/messagebus/src/vespa/messagebus/messagebus.cpp index 4cd19b62419..5a8f510ddcf 100644 --- a/messagebus/src/vespa/messagebus/messagebus.cpp +++ b/messagebus/src/vespa/messagebus/messagebus.cpp @@ -97,7 +97,7 @@ MessageBus::MessageBus(INetwork &net, ProtocolSet protocols) : MessageBusParams params; while (!protocols.empty()) { IProtocol::SP protocol = protocols.extract(); - if (protocol.get() != NULL) { + if (protocol.get() != nullptr) { params.addProtocol(protocol); } } @@ -155,7 +155,7 @@ MessageBus::setup(const MessageBusParams ¶ms) // Start messenger. IRetryPolicy::SP retryPolicy = params.getRetryPolicy(); - if (retryPolicy.get() != NULL) { + if (retryPolicy.get() != nullptr) { _resender.reset(new Resender(retryPolicy)); Messenger::ITask::UP task(new ResenderTask(*_resender)); @@ -271,7 +271,7 @@ MessageBus::sync() void MessageBus::handleMessage(Message::UP msg) { - if (_resender.get() != NULL && msg->hasBucketSequence()) { + if (_resender.get() != nullptr && msg->hasBucketSequence()) { deliverError(std::move(msg), ErrorCode::SEQUENCE_ERROR, "Bucket sequences not supported when resender is enabled."); return; @@ -359,7 +359,7 @@ MessageBus::handleDiscard(Context ctx) void MessageBus::deliverMessage(Message::UP msg, const string &session) { - IMessageHandler *msgHandler = NULL; + IMessageHandler *msgHandler = nullptr; { LockGuard guard(_lock); std::map<string, IMessageHandler*>::iterator it = _sessions.find(session); @@ -367,7 +367,7 @@ MessageBus::deliverMessage(Message::UP msg, const string &session) msgHandler = it->second; } } - if (msgHandler == NULL) { + if (msgHandler == nullptr) { deliverError(std::move(msg), ErrorCode::UNKNOWN_SESSION, make_string("Session '%s' does not exist.", session.c_str())); } else if (!checkPending(*msg)) { diff --git a/messagebus/src/vespa/messagebus/messenger.cpp b/messagebus/src/vespa/messagebus/messenger.cpp index 2d1204ee7b6..4b612b66c31 100644 --- a/messagebus/src/vespa/messagebus/messenger.cpp +++ b/messagebus/src/vespa/messagebus/messenger.cpp @@ -32,7 +32,7 @@ public: } ~MessageTask() { - if (_msg.get() != NULL) { + if (_msg.get() != nullptr) { _msg->discard(); } } @@ -42,7 +42,7 @@ public: } uint8_t priority() const override { - if (_msg.get() != NULL) { + if (_msg.get() != nullptr) { return _msg->priority(); } @@ -64,7 +64,7 @@ public: } ~ReplyTask() { - if (_reply.get() != NULL) { + if (_reply.get() != nullptr) { _reply->discard(); } } @@ -74,7 +74,7 @@ public: } uint8_t priority() const override { - if (_reply.get() != NULL) { + if (_reply.get() != nullptr) { return _reply->priority(); } @@ -205,7 +205,7 @@ Messenger::Run(FastOS_ThreadInterface *thread, void *arg) _queue.pop(); } } - if (task.get() != NULL) { + if (task.get() != nullptr) { try { task->run(); } catch (const std::exception &e) { diff --git a/messagebus/src/vespa/messagebus/network/oosmanager.cpp b/messagebus/src/vespa/messagebus/network/oosmanager.cpp index eecfe1da447..250df147675 100644 --- a/messagebus/src/vespa/messagebus/network/oosmanager.cpp +++ b/messagebus/src/vespa/messagebus/network/oosmanager.cpp @@ -89,7 +89,7 @@ OOSManager::isOOS(const string &service) return false; } vespalib::LockGuard guard(_lock); - if (_oosSet.get() == NULL) { + if (_oosSet.get() == nullptr) { return false; } if (_oosSet->find(service) == _oosSet->end()) { diff --git a/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp b/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp index b7f1d6de60d..55848e32d76 100644 --- a/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp +++ b/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp @@ -75,7 +75,7 @@ RPCNetwork::SendContext::handleVersion(const vespalib::Version *version) bool shouldSend = false; { vespalib::LockGuard guard(_lock); - if (version == NULL) { + if (version == nullptr) { _hasError = true; } else if (*version < _version) { _version = *version; @@ -298,7 +298,7 @@ RPCNetwork::resolveServiceAddress(RoutingNode &recipient, const string &serviceN serviceName.c_str())); } RPCServiceAddress::UP ret = _servicePool->resolve(serviceName); - if (ret.get() == NULL) { + if (ret.get() == nullptr) { return Error(ErrorCode::NO_ADDRESS_FOR_SERVICE, make_string("The address of service '%s' could not be resolved. It is not currently " "registered with the Vespa name server. " @@ -306,7 +306,7 @@ RPCNetwork::resolveServiceAddress(RoutingNode &recipient, const string &serviceN serviceName.c_str())); } RPCTarget::SP target = _targetPool->getTarget(*_orb, *ret); - if (target.get() == NULL) { + if (target.get() == nullptr) { return Error(ErrorCode::CONNECTION_ERROR, make_string("Failed to connect to service '%s'.", serviceName.c_str())); } @@ -328,7 +328,7 @@ RPCNetwork::send(const Message &msg, const std::vector<RoutingNode*> &recipients double timeout = ctx._msg.getTimeRemainingNow() / 1000.0; for (uint32_t i = 0, len = ctx._recipients.size(); i < len; ++i) { RoutingNode *&recipient = ctx._recipients[i]; - LOG_ASSERT(recipient != NULL); + LOG_ASSERT(recipient != nullptr); RPCServiceAddress &address = static_cast<RPCServiceAddress&>(recipient->getServiceAddress()); LOG_ASSERT(address.hasTarget()); @@ -346,7 +346,7 @@ RPCNetwork::send(RPCNetwork::SendContext &ctx) uint64_t timeRemaining = ctx._msg.getTimeRemainingNow(); Blob payload = _owner->getProtocol(ctx._msg.getProtocol())->encode(ctx._version, ctx._msg); RPCSendAdapter *adapter = getSendAdapter(ctx._version); - if (adapter == NULL) { + if (adapter == nullptr) { replyError(ctx, ErrorCode::INCOMPATIBLE_VERSION, make_string("Can not send to version '%s' recipient.", ctx._version.toString().c_str())); } else if (timeRemaining == 0) { diff --git a/messagebus/src/vespa/messagebus/network/rpcsend.cpp b/messagebus/src/vespa/messagebus/network/rpcsend.cpp index 588d5a006dd..56c23997c4c 100644 --- a/messagebus/src/vespa/messagebus/network/rpcsend.cpp +++ b/messagebus/src/vespa/messagebus/network/rpcsend.cpp @@ -53,7 +53,7 @@ private: } RPCSend::RPCSend() : - _net(NULL), + _net(nullptr), _clientIdent("client"), _serverIdent("server") { } diff --git a/messagebus/src/vespa/messagebus/network/rpcserviceaddress.h b/messagebus/src/vespa/messagebus/network/rpcserviceaddress.h index c6856057342..36dde19bd18 100644 --- a/messagebus/src/vespa/messagebus/network/rpcserviceaddress.h +++ b/messagebus/src/vespa/messagebus/network/rpcserviceaddress.h @@ -84,7 +84,7 @@ public: * * @return True if target is set. */ - bool hasTarget() const { return _target.get() != NULL; } + bool hasTarget() const { return _target.get() != nullptr; } }; } // namespace mbus diff --git a/messagebus/src/vespa/messagebus/network/rpctargetpool.cpp b/messagebus/src/vespa/messagebus/network/rpctargetpool.cpp index 20e5a2eb3e3..295814f4a8d 100644 --- a/messagebus/src/vespa/messagebus/network/rpctargetpool.cpp +++ b/messagebus/src/vespa/messagebus/network/rpctargetpool.cpp @@ -36,7 +36,7 @@ RPCTargetPool::flushTargets(bool force) TargetMap::iterator it = _targets.begin(); while (it != _targets.end()) { Entry &entry = it->second; - if (entry._target.get() != NULL) { + if (entry._target.get() != nullptr) { if (entry._target.use_count() > 1) { entry._lastUse = currentTime; ++it; diff --git a/messagebus/src/vespa/messagebus/protocolrepository.cpp b/messagebus/src/vespa/messagebus/protocolrepository.cpp index d2661e3ef80..4e2efcfb3b9 100644 --- a/messagebus/src/vespa/messagebus/protocolrepository.cpp +++ b/messagebus/src/vespa/messagebus/protocolrepository.cpp @@ -76,7 +76,7 @@ ProtocolRepository::getRoutingPolicy(const string &protocolName, } catch (const std::exception &e) { LOG(error, "Protocol '%s' threw an exception; %s", protocolName.c_str(), e.what()); } - if (policy.get() == NULL) { + if (policy.get() == nullptr) { LOG(error, "Protocol '%s' failed to create routing policy '%s' with parameter '%s'.", protocolName.c_str(), policyName.c_str(), policyParam.c_str()); return IRoutingPolicy::SP(); diff --git a/messagebus/src/vespa/messagebus/routing/routeparser.cpp b/messagebus/src/vespa/messagebus/routing/routeparser.cpp index 131ecbe3b33..668f14f9801 100644 --- a/messagebus/src/vespa/messagebus/routing/routeparser.cpp +++ b/messagebus/src/vespa/messagebus/routing/routeparser.cpp @@ -84,7 +84,7 @@ RouteParser::createHop(stringref str) } if (len > 4 && str.substr(0, 4) == "tcp/") { IHopDirective::SP tcp = createTcpDirective(str.substr(4)); - if (tcp.get() != NULL) { + if (tcp.get() != nullptr) { return Hop().addDirective(tcp); } } diff --git a/messagebus/src/vespa/messagebus/routing/routingnode.cpp b/messagebus/src/vespa/messagebus/routing/routingnode.cpp index 62efda4aeb9..6e100999e1d 100644 --- a/messagebus/src/vespa/messagebus/routing/routingnode.cpp +++ b/messagebus/src/vespa/messagebus/routing/routingnode.cpp @@ -21,7 +21,7 @@ RoutingNode::RoutingNode(MessageBus &mbus, INetwork &net, Resender *resender, : _mbus(mbus), _net(net), _resender(resender), - _parent(NULL), + _parent(nullptr), _recipients(), _children(), _replyHandler(&replyHandler), @@ -45,8 +45,8 @@ RoutingNode::RoutingNode(RoutingNode &parent, const Route &route) _parent(&parent), _recipients(parent._recipients), _children(), - _replyHandler(NULL), - _discardHandler(NULL), + _replyHandler(nullptr), + _discardHandler(nullptr), _trace(parent._trace.getLevel()), _pending(0), _msg(parent._msg), @@ -78,8 +78,8 @@ RoutingNode::clearChildren() void RoutingNode::discard() { - assert(_parent == NULL); - if (_discardHandler != NULL) { + assert(_parent == nullptr); + if (_discardHandler != nullptr) { _discardHandler->handleDiscard(Context()); } } @@ -101,7 +101,7 @@ RoutingNode::prepareForRetry() { _shouldRetry = false; _reply.reset(); - if (_routingContext.get() != NULL && _routingContext->getSelectOnRetry()) { + if (_routingContext.get() != nullptr && _routingContext->getSelectOnRetry()) { clearChildren(); } else if (!_children.empty()) { bool retryingSome = false; @@ -109,7 +109,7 @@ RoutingNode::prepareForRetry() it != _children.end(); ++it) { RoutingNode *child= *it; - if (child->_shouldRetry || child->_reply.get() == NULL) { + if (child->_shouldRetry || child->_reply.get() == nullptr) { child->prepareForRetry(); retryingSome = true; } @@ -126,11 +126,11 @@ RoutingNode::prepareForRetry() void RoutingNode::notifyParent() { - if (_serviceAddress.get() != NULL) { + if (_serviceAddress.get() != nullptr) { _net.freeServiceAddress(*this); } tryIgnoreResult(); - if (_parent != NULL) { + if (_parent != nullptr) { _parent->notifyMerge(); return; } @@ -174,7 +174,7 @@ RoutingNode::addError(uint32_t code, const string &msg) void RoutingNode::addError(const Error &err) { - if (_reply.get() != NULL) { + if (_reply.get() != nullptr) { _reply->getTrace().swap(_trace); _reply->addError(err); _reply->getTrace().swap(_trace); @@ -186,8 +186,8 @@ RoutingNode::addError(const Error &err) void RoutingNode::setReply(Reply::UP reply) { - if (reply.get() != NULL) { - _shouldRetry = _resender != NULL && _resender->shouldRetry(*reply); + if (reply.get() != nullptr) { + _shouldRetry = _resender != nullptr && _resender->shouldRetry(*reply); _trace.getRoot().addChild(reply->getTrace().getRoot()); reply->getTrace().clear(); } @@ -211,7 +211,7 @@ RoutingNode::notifyAbort(const string &msg) mystack.pop(); if (!node->_isActive) { // reply not pending - } else if (node->_reply.get() != NULL) { + } else if (node->_reply.get() != nullptr) { node->notifyParent(); } else if (node->_children.empty()) { node->setError(ErrorCode::SEND_ABORTED, msg); @@ -240,7 +240,7 @@ RoutingNode::notifyTransmit() if (node->hasReply()) { node->notifyParent(); } else { - assert(node->_serviceAddress.get() != NULL); + assert(node->_serviceAddress.get() != nullptr); sendTo.push_back(node); } } else { @@ -296,7 +296,7 @@ RoutingNode::notifyMerge() setError(ErrorCode::POLICY_ERROR, make_string("Policy '%s' threw an exception; %s", dir.getName().c_str(), e.what())); } - if (_reply.get() == NULL) { + if (_reply.get() == nullptr) { setError(ErrorCode::APP_FATAL_ERROR, make_string("Routing policy '%s' failed to merge replies.", dir.getName().c_str())); } @@ -315,12 +315,12 @@ RoutingNode::hasUnconsumedErrors() while (!mystack.empty()) { RoutingNode *node = mystack.top(); mystack.pop(); - if (node->_reply.get() != NULL) { + if (node->_reply.get() != nullptr) { for (uint32_t i = 0; i < node->_reply->getNumErrors(); ++i) { int errorCode = node->_reply->getError(i).getCode(); RoutingNode *it = node; - while (it != NULL) { - if (it->_routingContext.get() != NULL && + while (it != nullptr) { + if (it->_routingContext.get() != nullptr && it->_routingContext->isConsumableError(errorCode)) { errorCode = ErrorCode::NONE; @@ -329,7 +329,7 @@ RoutingNode::hasUnconsumedErrors() it = it->_parent; } if (errorCode != ErrorCode::NONE) { - _shouldRetry = _resender != NULL && _resender->canRetry(errorCode); + _shouldRetry = _resender != nullptr && _resender->canRetry(errorCode); if (!_shouldRetry) { return true; // no need to continue } @@ -374,17 +374,17 @@ RoutingNode::resolve(uint32_t depth) if (executePolicySelect()) { return resolveChildren(depth + 1); } - return _reply.get() != NULL; + return _reply.get() != nullptr; } _net.allocServiceAddress(*this); - return _serviceAddress.get() != NULL || _reply.get() != NULL; + return _serviceAddress.get() != nullptr || _reply.get() != nullptr; } bool RoutingNode::lookupHop() { RoutingTable::SP table = _mbus.getRoutingTable(_msg.getProtocol()); - if (table.get() != NULL) { + if (table.get() != nullptr) { string name = _route.getHop(0).getServiceName(); if (table->hasHop(name)) { const HopBlueprint *hop = table->getHop(name); @@ -404,7 +404,7 @@ RoutingNode::lookupRoute() Hop &hop = _route.getHop(0); if (hop.getDirective(0)->getType() == IHopDirective::TYPE_ROUTE) { RouteDirective &dir = static_cast<RouteDirective&>(*hop.getDirective(0)); - if (table.get() == NULL || !table->hasRoute(dir.getName())) { + if (table.get() == nullptr || !table->hasRoute(dir.getName())) { setError(ErrorCode::ILLEGAL_ROUTE, make_string("Route '%s' does not exist.", dir.getName().c_str())); return false; @@ -415,7 +415,7 @@ RoutingNode::lookupRoute() dir.getName().c_str(), _route.toString().c_str())); return true; } - if (table.get() != NULL) { + if (table.get() != nullptr) { string name = hop.getServiceName(); if (table->hasRoute(name)) { insertRoute(*table->getRoute(name)); @@ -474,7 +474,7 @@ RoutingNode::executePolicySelect() { const PolicyDirective &dir = _routingContext->getDirective(); _policy = _mbus.getRoutingPolicy(_msg.getProtocol(), dir.getName(), dir.getParam()); - if (_policy.get() == NULL) { + if (_policy.get() == nullptr) { setError(ErrorCode::UNKNOWN_POLICY, make_string( "Protocol '%s' could not create routing policy '%s' with parameter '%s'.", _msg.getProtocol().c_str(), dir.getName().c_str(), dir.getParam().c_str())); @@ -489,7 +489,7 @@ RoutingNode::executePolicySelect() return false; } if (_children.empty()) { - if (_reply.get() == NULL) { + if (_reply.get() == nullptr) { setError(ErrorCode::NO_SERVICES_FOR_ROUTE, make_string("Policy '%s' selected no recipients for route '%s'.", dir.getName().c_str(), _route.toString().c_str())); @@ -522,7 +522,7 @@ RoutingNode::resolveChildren(uint32_t childDepth) RoutingNode *child = *it; child->_trace.trace(TraceLevel::SPLIT_MERGE, make_string("Resolving '%s'.", child->_route.toString().c_str())); - child->_isActive = (child->_reply.get() == NULL); + child->_isActive = (child->_reply.get() == nullptr); if (child->_isActive) { ++numActiveChildren; if (!child->resolve(childDepth)) { @@ -562,7 +562,7 @@ RoutingNode::tryIgnoreResult() if (!shouldIgnoreResult()) { return false; } - if (_reply.get() == NULL || !_reply->hasErrors()) { + if (_reply.get() == nullptr || !_reply->hasErrors()) { return false; } setReply(Reply::UP(new EmptyReply())); diff --git a/messagebus/src/vespa/messagebus/routing/routingnode.h b/messagebus/src/vespa/messagebus/routing/routingnode.h index 28c836a6dec..8951785c621 100644 --- a/messagebus/src/vespa/messagebus/routing/routingnode.h +++ b/messagebus/src/vespa/messagebus/routing/routingnode.h @@ -228,7 +228,7 @@ public: */ RoutingNode(MessageBus &mbus, INetwork &net, Resender *resender, IReplyHandler &replyHandler, Message &msg, - IDiscardHandler *discardHandler = NULL); + IDiscardHandler *discardHandler = nullptr); /** * Destructor. Frees up any allocated resources, namely all child nodes of @@ -371,7 +371,7 @@ public: * * @return True if this node has a reply. */ - bool hasReply() const { return _reply.get() != NULL; } + bool hasReply() const { return _reply.get() != nullptr; } /** * Returns the reply of this node. @@ -421,7 +421,7 @@ public: * * @return True if an address is set. */ - bool hasServiceAddress() { return _serviceAddress.get() != NULL; } + bool hasServiceAddress() { return _serviceAddress.get() != nullptr; } /** * Returns the service address of this node. This is attached by the network diff --git a/messagebus/src/vespa/messagebus/routing/routingtable.cpp b/messagebus/src/vespa/messagebus/routing/routingtable.cpp index 7537605d9fa..58e1881dc90 100644 --- a/messagebus/src/vespa/messagebus/routing/routingtable.cpp +++ b/messagebus/src/vespa/messagebus/routing/routingtable.cpp @@ -54,7 +54,7 @@ const HopBlueprint * RoutingTable::getHop(const string &name) const { std::map<string, HopBlueprint>::const_iterator it = _hops.find(name); - return it != _hops.end() ? &(it->second) : NULL; + return it != _hops.end() ? &(it->second) : nullptr; } bool @@ -67,7 +67,7 @@ const Route * RoutingTable::getRoute(const string &name) const { std::map<string, Route>::const_iterator it = _routes.find(name); - return it != _routes.end() ? &(it->second) : NULL; + return it != _routes.end() ? &(it->second) : nullptr; } } // namespace mbus diff --git a/messagebus/src/vespa/messagebus/sequencer.cpp b/messagebus/src/vespa/messagebus/sequencer.cpp index 79fbd346c16..60fb3bdd39e 100644 --- a/messagebus/src/vespa/messagebus/sequencer.cpp +++ b/messagebus/src/vespa/messagebus/sequencer.cpp @@ -19,7 +19,7 @@ Sequencer::~Sequencer() { for (QueueMap::iterator it = _seqMap.begin(); it != _seqMap.end(); ++it) { MessageQueue *queue = it->second; - if (queue != NULL) { + if (queue != nullptr) { while (queue->size() > 0) { Message *msg = queue->front(); queue->pop(); @@ -40,7 +40,7 @@ Sequencer::filter(Message::UP msg) vespalib::LockGuard guard(_lock); QueueMap::iterator it = _seqMap.find(seqId); if (it != _seqMap.end()) { - if (it->second == NULL) { + if (it->second == nullptr) { it->second = new MessageQueue(); } msg->getTrace().trace(TraceLevel::COMPONENT, @@ -49,7 +49,7 @@ Sequencer::filter(Message::UP msg) msg.release(); return Message::UP(); } - _seqMap[seqId] = NULL; // insert empty queue + _seqMap[seqId] = nullptr; // insert empty queue } return std::move(msg); } @@ -69,7 +69,7 @@ Sequencer::handleMessage(Message::UP msg) { if (msg->hasSequenceId()) { msg = filter(std::move(msg)); - if (msg.get() != NULL) { + if (msg.get() != nullptr) { sequencedSend(std::move(msg)); } } else { @@ -89,8 +89,8 @@ Sequencer::handleReply(Reply::UP reply) QueueMap::iterator it = _seqMap.find(seq); MessageQueue *que = it->second; assert(it != _seqMap.end()); - if (que == NULL || que->size() == 0) { - if (que != NULL) { + if (que == nullptr || que->size() == 0) { + if (que != nullptr) { delete que; } _seqMap.erase(it); @@ -99,7 +99,7 @@ Sequencer::handleReply(Reply::UP reply) que->pop(); } } - if (msg.get() != NULL) { + if (msg.get() != nullptr) { sequencedSend(std::move(msg)); } IReplyHandler &handler = reply->getCallStack().pop(*reply); diff --git a/messagebus/src/vespa/messagebus/sourcesession.cpp b/messagebus/src/vespa/messagebus/sourcesession.cpp index 9a93a4aedf1..1dbdd307e17 100644 --- a/messagebus/src/vespa/messagebus/sourcesession.cpp +++ b/messagebus/src/vespa/messagebus/sourcesession.cpp @@ -41,9 +41,9 @@ SourceSession::send(Message::UP msg, const string &routeName, bool parseIfNotFou { bool found = false; RoutingTable::SP rt = _mbus.getRoutingTable(msg->getProtocol()); - if (rt.get() != NULL) { + if (rt.get() != nullptr) { const Route *route = rt->getRoute(routeName); - if (route != NULL) { + if (route != nullptr) { msg->setRoute(*route); found = true; } else if (!parseIfNotFound) { @@ -79,13 +79,13 @@ SourceSession::send(Message::UP msg) if (_closed) { return Result(Error(ErrorCode::SEND_QUEUE_CLOSED, "Source session is closed."), std::move(msg)); } - if (_throttlePolicy.get() != NULL && !_throttlePolicy->canSend(*msg, _pendingCount)) { + if (_throttlePolicy.get() != nullptr && !_throttlePolicy->canSend(*msg, _pendingCount)) { return Result(Error(ErrorCode::SEND_QUEUE_FULL, make_string("Too much pending data (%d messages).", _pendingCount)), std::move(msg)); } msg->pushHandler(_replyHandler); - if (_throttlePolicy.get() != NULL) { + if (_throttlePolicy.get() != nullptr) { _throttlePolicy->processMessage(*msg); } ++_pendingCount; @@ -108,7 +108,7 @@ SourceSession::handleReply(Reply::UP reply) vespalib::MonitorGuard guard(_monitor); assert(_pendingCount > 0); --_pendingCount; - if (_throttlePolicy.get() != NULL) { + if (_throttlePolicy.get() != nullptr) { _throttlePolicy->processReply(*reply); } done = (_closed && _pendingCount == 0); diff --git a/messagebus/src/vespa/messagebus/sourcesessionparams.cpp b/messagebus/src/vespa/messagebus/sourcesessionparams.cpp index 125b2a9822f..51fe91562ae 100644 --- a/messagebus/src/vespa/messagebus/sourcesessionparams.cpp +++ b/messagebus/src/vespa/messagebus/sourcesessionparams.cpp @@ -6,7 +6,7 @@ namespace mbus { SourceSessionParams::SourceSessionParams() : - _replyHandler(NULL), + _replyHandler(nullptr), _throttlePolicy(new DynamicThrottlePolicy()), _timeout(180.0) { } @@ -40,7 +40,7 @@ SourceSessionParams::setTimeout(double timeout) bool SourceSessionParams::hasReplyHandler() const { - return _replyHandler != NULL; + return _replyHandler != nullptr; } IReplyHandler & |