From 325e4a2fb9a616bde86d0cdfb8e4dcaff7e2dbda Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Thu, 30 Nov 2017 08:36:35 +0100 Subject: [PATCH] Use nullptr instead of ::Ptr() --- lib/base/configobject.cpp | 2 +- lib/base/configtype.cpp | 2 +- lib/base/configwriter.hpp | 2 +- lib/base/objecttype.cpp | 2 +- lib/base/primitivetype.cpp | 2 +- lib/base/process.hpp | 2 +- lib/base/scriptutils.cpp | 2 +- lib/base/serializer.cpp | 4 ++-- lib/base/type.cpp | 4 ++-- lib/base/value.cpp | 2 +- lib/base/value.hpp | 3 +++ lib/cli/clicommand.cpp | 2 +- lib/config/activationcontext.hpp | 2 +- lib/config/configitem.cpp | 12 ++++++------ lib/config/expression.hpp | 2 +- lib/config/vmops.hpp | 2 +- lib/db_ido/commanddbobject.cpp | 2 +- lib/db_ido/dbobject.cpp | 2 +- lib/db_ido/dbtype.cpp | 4 ++-- lib/db_ido/hostgroupdbobject.cpp | 2 +- lib/db_ido/servicegroupdbobject.cpp | 2 +- lib/db_ido/usergroupdbobject.cpp | 2 +- lib/db_ido_mysql/idomysqlconnection.cpp | 4 ++-- lib/db_ido_pgsql/idopgsqlconnection.cpp | 2 +- lib/demo/demo.cpp | 2 +- lib/icinga/apiactions.cpp | 2 +- lib/icinga/apiactions.hpp | 2 +- lib/icinga/checkable-check.cpp | 6 +++--- lib/icinga/checkable-dependency.cpp | 4 ++-- lib/icinga/checkable.cpp | 6 +++--- lib/icinga/checkable.hpp | 12 ++++++------ lib/icinga/checkcommand.hpp | 2 +- lib/icinga/clusterevents.cpp | 6 +++--- lib/icinga/comment.cpp | 2 +- lib/icinga/comment.hpp | 4 ++-- lib/icinga/comment.ti | 2 +- lib/icinga/compatutility.cpp | 2 +- lib/icinga/dependency.ti | 4 ++-- lib/icinga/downtime.cpp | 2 +- lib/icinga/downtime.hpp | 4 ++-- lib/icinga/downtime.ti | 2 +- lib/icinga/eventcommand.hpp | 2 +- lib/icinga/externalcommandprocessor.cpp | 4 ++-- lib/icinga/host.cpp | 2 +- lib/icinga/legacytimeperiod.cpp | 2 +- lib/icinga/macroprocessor.cpp | 4 ++-- lib/icinga/macroprocessor.hpp | 4 ++-- lib/icinga/notification.cpp | 4 ++-- lib/icinga/notification.ti | 2 +- lib/icinga/notificationcommand.hpp | 2 +- lib/icinga/objectutils.cpp | 4 ++-- lib/icinga/scheduleddowntime.ti | 2 +- lib/icinga/service.cpp | 4 ++-- lib/livestatus/hoststable.cpp | 4 ++-- lib/livestatus/livestatusquery.cpp | 2 +- lib/livestatus/logtable.cpp | 10 +++++----- lib/livestatus/servicestable.cpp | 6 +++--- lib/livestatus/statehisttable.cpp | 4 ++-- lib/livestatus/table.cpp | 2 +- lib/remote/actionshandler.cpp | 2 +- lib/remote/apiclient.cpp | 4 ++-- lib/remote/apilistener-configsync.cpp | 2 +- lib/remote/apilistener.cpp | 6 +++--- lib/remote/apilistener.hpp | 4 ++-- lib/remote/apiuser.cpp | 2 +- lib/remote/configpackageutility.hpp | 2 +- lib/remote/endpoint.cpp | 2 +- lib/remote/eventqueue.cpp | 3 +-- lib/remote/filterutility.cpp | 4 ++-- lib/remote/httpserverconnection.cpp | 2 +- lib/remote/jsonrpcconnection-pki.cpp | 2 +- lib/remote/zone.cpp | 2 +- 72 files changed, 117 insertions(+), 115 deletions(-) diff --git a/lib/base/configobject.cpp b/lib/base/configobject.cpp index 55b780e13..ea8d106a1 100644 --- a/lib/base/configobject.cpp +++ b/lib/base/configobject.cpp @@ -706,7 +706,7 @@ ConfigObject::Ptr ConfigObject::GetObject(const String& type, const String& name ConfigType *ctype = dynamic_cast(ptype.get()); if (!ctype) - return ConfigObject::Ptr(); + return nullptr; return ctype->GetObject(name); } diff --git a/lib/base/configtype.cpp b/lib/base/configtype.cpp index b3b8e0a39..a21eb142c 100644 --- a/lib/base/configtype.cpp +++ b/lib/base/configtype.cpp @@ -33,7 +33,7 @@ ConfigObject::Ptr ConfigType::GetObject(const String& name) const auto nt = m_ObjectMap.find(name); if (nt == m_ObjectMap.end()) - return ConfigObject::Ptr(); + return nullptr; return nt->second; } diff --git a/lib/base/configwriter.hpp b/lib/base/configwriter.hpp index c39a046ca..9573050d0 100644 --- a/lib/base/configwriter.hpp +++ b/lib/base/configwriter.hpp @@ -61,7 +61,7 @@ public: static void EmitArray(std::ostream& fp, int indentLevel, const Array::Ptr& val); static void EmitArrayItems(std::ostream& fp, int indentLevel, const Array::Ptr& val); static void EmitScope(std::ostream& fp, int indentLevel, const Dictionary::Ptr& val, - const Array::Ptr& imports = Array::Ptr(), bool splitDot = false); + const Array::Ptr& imports = nullptr, bool splitDot = false); static void EmitValue(std::ostream& fp, int indentLevel, const Value& val); static void EmitRaw(std::ostream& fp, const String& val); static void EmitIndent(std::ostream& fp, int indentLevel); diff --git a/lib/base/objecttype.cpp b/lib/base/objecttype.cpp index a172cf23d..e5cdba372 100644 --- a/lib/base/objecttype.cpp +++ b/lib/base/objecttype.cpp @@ -39,7 +39,7 @@ String ObjectType::GetName(void) const Type::Ptr ObjectType::GetBaseType(void) const { - return Type::Ptr(); + return nullptr; } int ObjectType::GetAttributes(void) const diff --git a/lib/base/primitivetype.cpp b/lib/base/primitivetype.cpp index 6a31d1a69..6c4f37bfc 100644 --- a/lib/base/primitivetype.cpp +++ b/lib/base/primitivetype.cpp @@ -34,7 +34,7 @@ String PrimitiveType::GetName(void) const Type::Ptr PrimitiveType::GetBaseType(void) const { if (m_Base == "None") - return Type::Ptr(); + return nullptr; else return Type::GetByName(m_Base); } diff --git a/lib/base/process.hpp b/lib/base/process.hpp index 9414c68da..8e39e7998 100644 --- a/lib/base/process.hpp +++ b/lib/base/process.hpp @@ -66,7 +66,7 @@ public: static const std::deque::size_type MaxTasksPerThread = 512; - Process(const Arguments& arguments, const Dictionary::Ptr& extraEnvironment = Dictionary::Ptr()); + Process(const Arguments& arguments, const Dictionary::Ptr& extraEnvironment = nullptr); ~Process(void); void SetTimeout(double timeout); diff --git a/lib/base/scriptutils.cpp b/lib/base/scriptutils.cpp index e3a1b64a7..785b4b942 100644 --- a/lib/base/scriptutils.cpp +++ b/lib/base/scriptutils.cpp @@ -405,7 +405,7 @@ ConfigObject::Ptr ScriptUtils::GetObject(const Value& vtype, const String& name) ConfigType *ctype = dynamic_cast(ptype.get()); if (!ctype) - return ConfigObject::Ptr(); + return nullptr; return ctype->GetObject(name); } diff --git a/lib/base/serializer.cpp b/lib/base/serializer.cpp index 5485c12b4..f51493aea 100644 --- a/lib/base/serializer.cpp +++ b/lib/base/serializer.cpp @@ -55,7 +55,7 @@ static Object::Ptr SerializeObject(const Object::Ptr& input, int attributeTypes) Type::Ptr type = input->GetReflectionType(); if (!type) - return Object::Ptr(); + return nullptr; Dictionary::Ptr fields = new Dictionary(); @@ -168,7 +168,7 @@ Value icinga::Serialize(const Value& value, int attributeTypes) Value icinga::Deserialize(const Value& value, bool safe_mode, int attributeTypes) { - return Deserialize(Object::Ptr(), value, safe_mode, attributeTypes); + return Deserialize(nullptr, value, safe_mode, attributeTypes); } Value icinga::Deserialize(const Object::Ptr& object, const Value& value, bool safe_mode, int attributeTypes) diff --git a/lib/base/type.cpp b/lib/base/type.cpp index cb2b2e2fa..f58d6e193 100644 --- a/lib/base/type.cpp +++ b/lib/base/type.cpp @@ -49,12 +49,12 @@ Type::Ptr Type::GetByName(const String& name) Dictionary::Ptr typesNS = ScriptGlobal::Get("Types", &Empty); if (!typesNS) - return Type::Ptr(); + return nullptr; Value ptype = typesNS->Get(name); if (!ptype.IsObjectType()) - return Type::Ptr(); + return nullptr; return ptype; } diff --git a/lib/base/value.cpp b/lib/base/value.cpp index 6b1db8e8b..e219fd60e 100644 --- a/lib/base/value.cpp +++ b/lib/base/value.cpp @@ -100,7 +100,7 @@ Type::Ptr Value::GetReflectionType(void) const case ValueObject: return boost::get(m_Value)->GetReflectionType(); default: - return Type::Ptr(); + return nullptr; } } diff --git a/lib/base/value.hpp b/lib/base/value.hpp index 85f4aedde..bb32a9b0a 100644 --- a/lib/base/value.hpp +++ b/lib/base/value.hpp @@ -55,6 +55,9 @@ public: inline Value(void) { } + inline Value(std::nullptr_t) + { } + inline Value(int value) : m_Value(double(value)) { } diff --git a/lib/cli/clicommand.cpp b/lib/cli/clicommand.cpp index ec8a04e3a..6e4b8b2f2 100644 --- a/lib/cli/clicommand.cpp +++ b/lib/cli/clicommand.cpp @@ -130,7 +130,7 @@ CLICommand::Ptr CLICommand::GetByName(const std::vector& name) auto it = GetRegistry().find(name); if (it == GetRegistry().end()) - return CLICommand::Ptr(); + return nullptr; return it->second; } diff --git a/lib/config/activationcontext.hpp b/lib/config/activationcontext.hpp index 22ba22009..324be2b2b 100644 --- a/lib/config/activationcontext.hpp +++ b/lib/config/activationcontext.hpp @@ -49,7 +49,7 @@ private: class I2_CONFIG_API ActivationScope { public: - ActivationScope(const ActivationContext::Ptr& context = ActivationContext::Ptr()); + ActivationScope(const ActivationContext::Ptr& context = nullptr); ~ActivationScope(void); ActivationContext::Ptr GetContext(void) const; diff --git a/lib/config/configitem.cpp b/lib/config/configitem.cpp index edb0527ba..9227db3e6 100644 --- a/lib/config/configitem.cpp +++ b/lib/config/configitem.cpp @@ -185,7 +185,7 @@ ConfigObject::Ptr ConfigItem::Commit(bool discard) BOOST_THROW_EXCEPTION(ScriptError("Type '" + GetType() + "' does not exist.", m_DebugInfo)); if (IsAbstract()) - return ConfigObject::Ptr(); + return nullptr; ConfigObject::Ptr dobj = static_pointer_cast(type->Instantiate(std::vector())); @@ -211,7 +211,7 @@ ConfigObject::Ptr ConfigItem::Commit(bool discard) m_IgnoredItems.push_back(m_DebugInfo.Path); } - return ConfigObject::Ptr(); + return nullptr; } throw; @@ -263,7 +263,7 @@ ConfigObject::Ptr ConfigItem::Commit(bool discard) m_IgnoredItems.push_back(m_DebugInfo.Path); } - return ConfigObject::Ptr(); + return nullptr; } ex.SetDebugHint(dhint); @@ -282,7 +282,7 @@ ConfigObject::Ptr ConfigItem::Commit(bool discard) m_IgnoredItems.push_back(m_DebugInfo.Path); } - return ConfigObject::Ptr(); + return nullptr; } throw; @@ -378,12 +378,12 @@ ConfigItem::Ptr ConfigItem::GetByTypeAndName(const Type::Ptr& type, const String auto it = m_Items.find(type); if (it == m_Items.end()) - return ConfigItem::Ptr(); + return nullptr; auto it2 = it->second.find(name); if (it2 == it->second.end()) - return ConfigItem::Ptr(); + return nullptr; return it2->second; } diff --git a/lib/config/expression.hpp b/lib/config/expression.hpp index dec6f1c75..9c1509650 100644 --- a/lib/config/expression.hpp +++ b/lib/config/expression.hpp @@ -36,7 +36,7 @@ namespace icinga struct DebugHint { public: - DebugHint(const Dictionary::Ptr& hints = Dictionary::Ptr()) + DebugHint(const Dictionary::Ptr& hints = nullptr) : m_Hints(hints) { } diff --git a/lib/config/vmops.hpp b/lib/config/vmops.hpp index 4376f32d7..0c56fee71 100644 --- a/lib/config/vmops.hpp +++ b/lib/config/vmops.hpp @@ -152,7 +152,7 @@ public: NameComposer *nc = dynamic_cast(type.get()); if (nc) - checkName = nc->MakeName(name, Dictionary::Ptr()); + checkName = nc->MakeName(name, nullptr); } if (!checkName.IsEmpty()) { diff --git a/lib/db_ido/commanddbobject.cpp b/lib/db_ido/commanddbobject.cpp index 1b059d2aa..12e6d5869 100644 --- a/lib/db_ido/commanddbobject.cpp +++ b/lib/db_ido/commanddbobject.cpp @@ -45,5 +45,5 @@ Dictionary::Ptr CommandDbObject::GetConfigFields(void) const Dictionary::Ptr CommandDbObject::GetStatusFields(void) const { - return Dictionary::Ptr(); + return nullptr; } diff --git a/lib/db_ido/dbobject.cpp b/lib/db_ido/dbobject.cpp index a606a2e67..ab39a5eff 100644 --- a/lib/db_ido/dbobject.cpp +++ b/lib/db_ido/dbobject.cpp @@ -354,7 +354,7 @@ DbObject::Ptr DbObject::GetOrCreateByObject(const ConfigObject::Ptr& object) DbType::Ptr dbtype = DbType::GetByName(object->GetReflectionType()->GetName()); if (!dbtype) - return DbObject::Ptr(); + return nullptr; Service::Ptr service; String name1, name2; diff --git a/lib/db_ido/dbtype.cpp b/lib/db_ido/dbtype.cpp index 6baf2d2bc..9877c5746 100644 --- a/lib/db_ido/dbtype.cpp +++ b/lib/db_ido/dbtype.cpp @@ -68,7 +68,7 @@ DbType::Ptr DbType::GetByName(const String& name) auto it = GetTypes().find(typeName); if (it == GetTypes().end()) - return DbType::Ptr(); + return nullptr; return it->second; } @@ -82,7 +82,7 @@ DbType::Ptr DbType::GetByID(long tid) return kv.second; } - return DbType::Ptr(); + return nullptr; } DbObject::Ptr DbType::GetOrCreateObjectByName(const String& name1, const String& name2) diff --git a/lib/db_ido/hostgroupdbobject.cpp b/lib/db_ido/hostgroupdbobject.cpp index f9d919744..b16000068 100644 --- a/lib/db_ido/hostgroupdbobject.cpp +++ b/lib/db_ido/hostgroupdbobject.cpp @@ -47,5 +47,5 @@ Dictionary::Ptr HostGroupDbObject::GetConfigFields(void) const Dictionary::Ptr HostGroupDbObject::GetStatusFields(void) const { - return Dictionary::Ptr(); + return nullptr; } diff --git a/lib/db_ido/servicegroupdbobject.cpp b/lib/db_ido/servicegroupdbobject.cpp index 06068ce32..1cb529acb 100644 --- a/lib/db_ido/servicegroupdbobject.cpp +++ b/lib/db_ido/servicegroupdbobject.cpp @@ -46,5 +46,5 @@ Dictionary::Ptr ServiceGroupDbObject::GetConfigFields(void) const Dictionary::Ptr ServiceGroupDbObject::GetStatusFields(void) const { - return Dictionary::Ptr(); + return nullptr; } diff --git a/lib/db_ido/usergroupdbobject.cpp b/lib/db_ido/usergroupdbobject.cpp index 5954f16fe..60390325f 100644 --- a/lib/db_ido/usergroupdbobject.cpp +++ b/lib/db_ido/usergroupdbobject.cpp @@ -44,5 +44,5 @@ Dictionary::Ptr UserGroupDbObject::GetConfigFields(void) const Dictionary::Ptr UserGroupDbObject::GetStatusFields(void) const { - return Dictionary::Ptr(); + return nullptr; } diff --git a/lib/db_ido_mysql/idomysqlconnection.cpp b/lib/db_ido_mysql/idomysqlconnection.cpp index 1ed3a8c97..59be843ea 100644 --- a/lib/db_ido_mysql/idomysqlconnection.cpp +++ b/lib/db_ido_mysql/idomysqlconnection.cpp @@ -684,12 +684,12 @@ Dictionary::Ptr IdoMysqlConnection::FetchRow(const IdoMysqlResult& result) row = mysql_fetch_row(result.get()); if (!row) - return Dictionary::Ptr(); + return nullptr; lengths = mysql_fetch_lengths(result.get()); if (!lengths) - return Dictionary::Ptr(); + return nullptr; Dictionary::Ptr dict = new Dictionary(); diff --git a/lib/db_ido_pgsql/idopgsqlconnection.cpp b/lib/db_ido_pgsql/idopgsqlconnection.cpp index 035a9c9d0..2db019072 100644 --- a/lib/db_ido_pgsql/idopgsqlconnection.cpp +++ b/lib/db_ido_pgsql/idopgsqlconnection.cpp @@ -522,7 +522,7 @@ Dictionary::Ptr IdoPgsqlConnection::FetchRow(const IdoPgsqlResult& result, int r AssertOnWorkQueue(); if (row >= PQntuples(result.get())) - return Dictionary::Ptr(); + return nullptr; int columns = PQnfields(result.get()); diff --git a/lib/demo/demo.cpp b/lib/demo/demo.cpp index f54aa270b..d213515c0 100644 --- a/lib/demo/demo.cpp +++ b/lib/demo/demo.cpp @@ -54,7 +54,7 @@ void Demo::DemoTimerHandler(void) ApiListener::Ptr listener = ApiListener::GetInstance(); if (listener) { MessageOrigin::Ptr origin = new MessageOrigin(); - listener->RelayMessage(origin, ConfigObject::Ptr(), message, true); + listener->RelayMessage(origin, nullptr, message, true); Log(LogInformation, "Demo", "Sent demo::HelloWorld message"); } } diff --git a/lib/icinga/apiactions.cpp b/lib/icinga/apiactions.cpp index a44ebb29c..e4070324a 100644 --- a/lib/icinga/apiactions.cpp +++ b/lib/icinga/apiactions.cpp @@ -165,7 +165,7 @@ Dictionary::Ptr ApiActions::SendCustomNotification(const ConfigObject::Ptr& obje checkable->SetForceNextNotification(true); Checkable::OnNotificationsRequested(checkable, NotificationCustom, checkable->GetLastCheckResult(), - HttpUtility::GetLastParameter(params, "author"), HttpUtility::GetLastParameter(params, "comment"), MessageOrigin::Ptr()); + HttpUtility::GetLastParameter(params, "author"), HttpUtility::GetLastParameter(params, "comment"), nullptr); return ApiActions::CreateResult(200, "Successfully sent custom notification for object '" + checkable->GetName() + "'."); } diff --git a/lib/icinga/apiactions.hpp b/lib/icinga/apiactions.hpp index 8bfcd8a4e..9b037183f 100644 --- a/lib/icinga/apiactions.hpp +++ b/lib/icinga/apiactions.hpp @@ -48,7 +48,7 @@ public: static Dictionary::Ptr GenerateTicket(const ConfigObject::Ptr& object, const Dictionary::Ptr& params); private: - static Dictionary::Ptr CreateResult(int code, const String& status, const Dictionary::Ptr& additional = Dictionary::Ptr()); + static Dictionary::Ptr CreateResult(int code, const String& status, const Dictionary::Ptr& additional = nullptr); }; } diff --git a/lib/icinga/checkable-check.cpp b/lib/icinga/checkable-check.cpp index 893903ba4..61a4905a2 100644 --- a/lib/icinga/checkable-check.cpp +++ b/lib/icinga/checkable-check.cpp @@ -371,7 +371,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig if (!in_downtime && !was_flapping && is_flapping) { /* FlappingStart notifications happen on state changes, not in downtimes */ if (!IsPaused()) - OnNotificationsRequested(this, NotificationFlappingStart, cr, "", "", MessageOrigin::Ptr()); + OnNotificationsRequested(this, NotificationFlappingStart, cr, "", "", nullptr); Log(LogNotice, "Checkable") << "Flapping Start: Checkable '" << GetName() << "' started flapping (Current flapping value " @@ -381,7 +381,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig } else if (!in_downtime && was_flapping && !is_flapping) { /* FlappingEnd notifications are independent from state changes, must not happen in downtine */ if (!IsPaused()) - OnNotificationsRequested(this, NotificationFlappingEnd, cr, "", "", MessageOrigin::Ptr()); + OnNotificationsRequested(this, NotificationFlappingEnd, cr, "", "", nullptr); Log(LogNotice, "Checkable") << "Flapping Stop: Checkable '" << GetName() << "' stopped flapping (Current flapping value " @@ -392,7 +392,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig if (send_notification && !is_flapping) { if (!IsPaused()) - OnNotificationsRequested(this, recovery ? NotificationRecovery : NotificationProblem, cr, "", "", MessageOrigin::Ptr()); + OnNotificationsRequested(this, recovery ? NotificationRecovery : NotificationProblem, cr, "", "", nullptr); } } diff --git a/lib/icinga/checkable-dependency.cpp b/lib/icinga/checkable-dependency.cpp index 90714fc9d..c567f474b 100644 --- a/lib/icinga/checkable-dependency.cpp +++ b/lib/icinga/checkable-dependency.cpp @@ -80,7 +80,7 @@ bool Checkable::IsReachable(DependencyType dt, Dependency::Ptr *failedDependency if (host && host->GetState() != HostUp && host->GetStateType() == StateTypeHard) { if (failedDependency) - *failedDependency = Dependency::Ptr(); + *failedDependency = nullptr; return false; } @@ -96,7 +96,7 @@ bool Checkable::IsReachable(DependencyType dt, Dependency::Ptr *failedDependency } if (failedDependency) - *failedDependency = Dependency::Ptr(); + *failedDependency = nullptr; return true; } diff --git a/lib/icinga/checkable.cpp b/lib/icinga/checkable.cpp index 1fbfa47ab..86cea0fc0 100644 --- a/lib/icinga/checkable.cpp +++ b/lib/icinga/checkable.cpp @@ -128,7 +128,7 @@ void Checkable::AcknowledgeProblem(const String& author, const String& comment, SetAcknowledgementExpiry(expiry); if (notify && !IsPaused()) - OnNotificationsRequested(this, NotificationAcknowledgement, GetLastCheckResult(), author, comment, MessageOrigin::Ptr()); + OnNotificationsRequested(this, NotificationAcknowledgement, GetLastCheckResult(), author, comment, nullptr); OnAcknowledgementSet(this, author, comment, type, notify, persistent, expiry, origin); } @@ -173,7 +173,7 @@ void Checkable::NotifyDowntimeInternal(const Downtime::Ptr& downtime) Checkable::Ptr checkable = downtime->GetCheckable(); if (!checkable->IsPaused()) - OnNotificationsRequested(checkable, NotificationDowntimeStart, checkable->GetLastCheckResult(), downtime->GetAuthor(), downtime->GetComment(), MessageOrigin::Ptr()); + OnNotificationsRequested(checkable, NotificationDowntimeStart, checkable->GetLastCheckResult(), downtime->GetAuthor(), downtime->GetComment(), nullptr); } void Checkable::NotifyDowntimeEnd(const Downtime::Ptr& downtime) @@ -185,7 +185,7 @@ void Checkable::NotifyDowntimeEnd(const Downtime::Ptr& downtime) Checkable::Ptr checkable = downtime->GetCheckable(); if (!checkable->IsPaused()) - OnNotificationsRequested(checkable, NotificationDowntimeEnd, checkable->GetLastCheckResult(), downtime->GetAuthor(), downtime->GetComment(), MessageOrigin::Ptr()); + OnNotificationsRequested(checkable, NotificationDowntimeEnd, checkable->GetLastCheckResult(), downtime->GetAuthor(), downtime->GetComment(), nullptr); } void Checkable::ValidateCheckInterval(double value, const ValidationUtils& utils) diff --git a/lib/icinga/checkable.hpp b/lib/icinga/checkable.hpp index b2d118c31..ca7b479ba 100644 --- a/lib/icinga/checkable.hpp +++ b/lib/icinga/checkable.hpp @@ -98,8 +98,8 @@ public: AcknowledgementType GetAcknowledgement(void); - void AcknowledgeProblem(const String& author, const String& comment, AcknowledgementType type, bool notify = true, bool persistent = false, double expiry = 0, const MessageOrigin::Ptr& origin = MessageOrigin::Ptr()); - void ClearAcknowledgement(const MessageOrigin::Ptr& origin = MessageOrigin::Ptr()); + void AcknowledgeProblem(const String& author, const String& comment, AcknowledgementType type, bool notify = true, bool persistent = false, double expiry = 0, const MessageOrigin::Ptr& origin = nullptr); + void ClearAcknowledgement(const MessageOrigin::Ptr& origin = nullptr); virtual int GetSeverity(void) const override; @@ -110,7 +110,7 @@ public: long GetSchedulingOffset(void); void SetSchedulingOffset(long offset); - void UpdateNextCheck(const MessageOrigin::Ptr& origin = MessageOrigin::Ptr()); + void UpdateNextCheck(const MessageOrigin::Ptr& origin = nullptr); bool HasBeenChecked(void) const; virtual bool IsStateOK(ServiceState state) = 0; @@ -121,9 +121,9 @@ public: static void UpdateStatistics(const CheckResult::Ptr& cr, CheckableType type); - void ExecuteRemoteCheck(const Dictionary::Ptr& resolvedMacros = Dictionary::Ptr()); + void ExecuteRemoteCheck(const Dictionary::Ptr& resolvedMacros = nullptr); void ExecuteCheck(); - void ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrigin::Ptr& origin = MessageOrigin::Ptr()); + void ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrigin::Ptr& origin = nullptr); Endpoint::Ptr GetCommandEndpoint(void) const; @@ -174,7 +174,7 @@ public: void ResetNotificationNumbers(void); /* Event Handler */ - void ExecuteEventHandler(const Dictionary::Ptr& resolvedMacros = Dictionary::Ptr(), + void ExecuteEventHandler(const Dictionary::Ptr& resolvedMacros = nullptr, bool useResolvedMacros = false); intrusive_ptr GetEventCommand(void) const; diff --git a/lib/icinga/checkcommand.hpp b/lib/icinga/checkcommand.hpp index 9be3521ec..91d8445ef 100644 --- a/lib/icinga/checkcommand.hpp +++ b/lib/icinga/checkcommand.hpp @@ -38,7 +38,7 @@ public: DECLARE_OBJECTNAME(CheckCommand); virtual void Execute(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, - const Dictionary::Ptr& resolvedMacros = Dictionary::Ptr(), + const Dictionary::Ptr& resolvedMacros = nullptr, bool useResolvedMacros = false); }; diff --git a/lib/icinga/clusterevents.cpp b/lib/icinga/clusterevents.cpp index 57b4691e1..3262d881b 100644 --- a/lib/icinga/clusterevents.cpp +++ b/lib/icinga/clusterevents.cpp @@ -704,7 +704,7 @@ void ClusterEvents::SendNotificationsHandler(const Checkable::Ptr& checkable, No params->Set("author", author); params->Set("text", text); - listener->RelayMessage(origin, ConfigObject::Ptr(), message, true); + listener->RelayMessage(origin, nullptr, message, true); } Value ClusterEvents::SendNotificationsAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params) @@ -798,7 +798,7 @@ void ClusterEvents::NotificationSentUserHandler(const Notification::Ptr& notific message->Set("method", "event::NotificationSentUser"); message->Set("params", params); - listener->RelayMessage(origin, ConfigObject::Ptr(), message, true); + listener->RelayMessage(origin, nullptr, message, true); } Value ClusterEvents::NotificationSentUserAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params) @@ -914,7 +914,7 @@ void ClusterEvents::NotificationSentToAllUsersHandler(const Notification::Ptr& n message->Set("method", "event::NotificationSentToAllUsers"); message->Set("params", params); - listener->RelayMessage(origin, ConfigObject::Ptr(), message, true); + listener->RelayMessage(origin, nullptr, message, true); } Value ClusterEvents::NotificationSentToAllUsersAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params) diff --git a/lib/icinga/comment.cpp b/lib/icinga/comment.cpp index 84f862e21..3bc736f15 100644 --- a/lib/icinga/comment.cpp +++ b/lib/icinga/comment.cpp @@ -181,7 +181,7 @@ String Comment::AddComment(const Checkable::Ptr& checkable, CommentType entryTyp if (!zone.IsEmpty()) attrs->Set("zone", zone); - String config = ConfigObjectUtility::CreateObjectConfig(Comment::TypeInstance, fullName, true, Array::Ptr(), attrs); + String config = ConfigObjectUtility::CreateObjectConfig(Comment::TypeInstance, fullName, true, nullptr, attrs); Array::Ptr errors = new Array(); diff --git a/lib/icinga/comment.hpp b/lib/icinga/comment.hpp index d2ccfa848..26f824cec 100644 --- a/lib/icinga/comment.hpp +++ b/lib/icinga/comment.hpp @@ -50,9 +50,9 @@ public: static String AddComment(const intrusive_ptr& checkable, CommentType entryType, const String& author, const String& text, bool persistent, double expireTime, - const String& id = String(), const MessageOrigin::Ptr& origin = MessageOrigin::Ptr()); + const String& id = String(), const MessageOrigin::Ptr& origin = nullptr); - static void RemoveComment(const String& id, const MessageOrigin::Ptr& origin = MessageOrigin::Ptr()); + static void RemoveComment(const String& id, const MessageOrigin::Ptr& origin = nullptr); static String GetCommentIDFromLegacyID(int id); diff --git a/lib/icinga/comment.ti b/lib/icinga/comment.ti index aaf3e3986..093195beb 100644 --- a/lib/icinga/comment.ti +++ b/lib/icinga/comment.ti @@ -72,7 +72,7 @@ class Comment : ConfigObject < CommentNameComposer }}} navigate {{{ if (GetServiceName().IsEmpty()) - return Service::Ptr(); + return nullptr; Host::Ptr host = Host::GetByName(GetHostName()); return host->GetServiceByShortName(GetServiceName()); diff --git a/lib/icinga/compatutility.cpp b/lib/icinga/compatutility.cpp index b66f4b7b6..80a6a85ba 100644 --- a/lib/icinga/compatutility.cpp +++ b/lib/icinga/compatutility.cpp @@ -368,7 +368,7 @@ Dictionary::Ptr CompatUtility::GetCustomAttributeConfig(const CustomVarObject::P Dictionary::Ptr vars = object->GetVars(); if (!vars) - return Dictionary::Ptr(); + return nullptr; return vars; } diff --git a/lib/icinga/dependency.ti b/lib/icinga/dependency.ti index 79a17bfac..bb347a2c2 100644 --- a/lib/icinga/dependency.ti +++ b/lib/icinga/dependency.ti @@ -60,7 +60,7 @@ class Dependency : CustomVarObject < DependencyNameComposer }}} navigate {{{ if (GetChildServiceName().IsEmpty()) - return Service::Ptr(); + return nullptr; Host::Ptr host = Host::GetByName(GetChildHostName()); return host->GetServiceByShortName(GetChildServiceName()); @@ -87,7 +87,7 @@ class Dependency : CustomVarObject < DependencyNameComposer }}} navigate {{{ if (GetParentServiceName().IsEmpty()) - return Service::Ptr(); + return nullptr; Host::Ptr host = Host::GetByName(GetParentHostName()); return host->GetServiceByShortName(GetParentServiceName()); diff --git a/lib/icinga/downtime.cpp b/lib/icinga/downtime.cpp index bf8b6d214..6a873d3f8 100644 --- a/lib/icinga/downtime.cpp +++ b/lib/icinga/downtime.cpp @@ -255,7 +255,7 @@ String Downtime::AddDowntime(const Checkable::Ptr& checkable, const String& auth if (!zone.IsEmpty()) attrs->Set("zone", zone); - String config = ConfigObjectUtility::CreateObjectConfig(Downtime::TypeInstance, fullName, true, Array::Ptr(), attrs); + String config = ConfigObjectUtility::CreateObjectConfig(Downtime::TypeInstance, fullName, true, nullptr, attrs); Array::Ptr errors = new Array(); diff --git a/lib/icinga/downtime.hpp b/lib/icinga/downtime.hpp index c5e0ef66e..46de4a4d1 100644 --- a/lib/icinga/downtime.hpp +++ b/lib/icinga/downtime.hpp @@ -57,9 +57,9 @@ public: const String& comment, double startTime, double endTime, bool fixed, const String& triggeredBy, double duration, const String& scheduledDowntime = String(), const String& scheduledBy = String(), const String& id = String(), - const MessageOrigin::Ptr& origin = MessageOrigin::Ptr()); + const MessageOrigin::Ptr& origin = nullptr); - static void RemoveDowntime(const String& id, bool cancelled, bool expired = false, const MessageOrigin::Ptr& origin = MessageOrigin::Ptr()); + static void RemoveDowntime(const String& id, bool cancelled, bool expired = false, const MessageOrigin::Ptr& origin = nullptr); void TriggerDowntime(void); diff --git a/lib/icinga/downtime.ti b/lib/icinga/downtime.ti index a392ebb22..1ce92cef7 100644 --- a/lib/icinga/downtime.ti +++ b/lib/icinga/downtime.ti @@ -59,7 +59,7 @@ class Downtime : ConfigObject < DowntimeNameComposer }}} navigate {{{ if (GetServiceName().IsEmpty()) - return Service::Ptr(); + return nullptr; Host::Ptr host = Host::GetByName(GetHostName()); return host->GetServiceByShortName(GetServiceName()); diff --git a/lib/icinga/eventcommand.hpp b/lib/icinga/eventcommand.hpp index a0d327ecd..b762fae46 100644 --- a/lib/icinga/eventcommand.hpp +++ b/lib/icinga/eventcommand.hpp @@ -38,7 +38,7 @@ public: DECLARE_OBJECTNAME(EventCommand); virtual void Execute(const Checkable::Ptr& checkable, - const Dictionary::Ptr& resolvedMacros = Dictionary::Ptr(), + const Dictionary::Ptr& resolvedMacros = nullptr, bool useResolvedMacros = false); }; diff --git a/lib/icinga/externalcommandprocessor.cpp b/lib/icinga/externalcommandprocessor.cpp index d1c9f73e0..84d648458 100644 --- a/lib/icinga/externalcommandprocessor.cpp +++ b/lib/icinga/externalcommandprocessor.cpp @@ -1358,7 +1358,7 @@ void ExternalCommandProcessor::SendCustomHostNotification(double, const std::vec } Checkable::OnNotificationsRequested(host, NotificationCustom, - host->GetLastCheckResult(), arguments[2], arguments[3], MessageOrigin::Ptr()); + host->GetLastCheckResult(), arguments[2], arguments[3], nullptr); } void ExternalCommandProcessor::SendCustomSvcNotification(double, const std::vector& arguments) @@ -1378,7 +1378,7 @@ void ExternalCommandProcessor::SendCustomSvcNotification(double, const std::vect } Service::OnNotificationsRequested(service, NotificationCustom, - service->GetLastCheckResult(), arguments[3], arguments[4], MessageOrigin::Ptr()); + service->GetLastCheckResult(), arguments[3], arguments[4], nullptr); } void ExternalCommandProcessor::DelayHostNotification(double, const std::vector& arguments) diff --git a/lib/icinga/host.cpp b/lib/icinga/host.cpp index c84eddae2..f90a6038c 100644 --- a/lib/icinga/host.cpp +++ b/lib/icinga/host.cpp @@ -144,7 +144,7 @@ Service::Ptr Host::GetServiceByShortName(const Value& name) return it->second; } - return Service::Ptr(); + return nullptr; } else if (name.IsObjectType()) { Dictionary::Ptr dict = name; String short_name; diff --git a/lib/icinga/legacytimeperiod.cpp b/lib/icinga/legacytimeperiod.cpp index 6d89839ea..4a831901a 100644 --- a/lib/icinga/legacytimeperiod.cpp +++ b/lib/icinga/legacytimeperiod.cpp @@ -451,7 +451,7 @@ Dictionary::Ptr LegacyTimePeriod::FindNextSegment(const String& daydef, const St } while (tsiter < tsend); } - return Dictionary::Ptr(); + return nullptr; } Array::Ptr LegacyTimePeriod::ScriptFunc(const TimePeriod::Ptr& tp, double begin, double end) diff --git a/lib/icinga/macroprocessor.cpp b/lib/icinga/macroprocessor.cpp index 465667ed4..fb9f918f3 100644 --- a/lib/icinga/macroprocessor.cpp +++ b/lib/icinga/macroprocessor.cpp @@ -291,7 +291,7 @@ Value MacroProcessor::InternalResolveMacros(const String& str, const ResolverLis for (const Value& value : arr) { if (value.IsScalar()) { resolved_arr->Add(InternalResolveMacros(value, - resolvers, cr, missingMacro, EscapeCallback(), Dictionary::Ptr(), + resolvers, cr, missingMacro, EscapeCallback(), nullptr, false, recursionLevel + 1)); } else resolved_arr->Add(value); @@ -300,7 +300,7 @@ Value MacroProcessor::InternalResolveMacros(const String& str, const ResolverLis resolved_macro = resolved_arr; } else if (resolved_macro.IsString()) { resolved_macro = InternalResolveMacros(resolved_macro, - resolvers, cr, missingMacro, EscapeCallback(), Dictionary::Ptr(), + resolvers, cr, missingMacro, EscapeCallback(), nullptr, false, recursionLevel + 1); } } diff --git a/lib/icinga/macroprocessor.hpp b/lib/icinga/macroprocessor.hpp index bd5e0dac8..0adc5acbc 100644 --- a/lib/icinga/macroprocessor.hpp +++ b/lib/icinga/macroprocessor.hpp @@ -41,9 +41,9 @@ public: typedef std::vector ResolverList; static Value ResolveMacros(const Value& str, const ResolverList& resolvers, - const CheckResult::Ptr& cr = CheckResult::Ptr(), String *missingMacro = NULL, + const CheckResult::Ptr& cr = nullptr, String *missingMacro = NULL, const EscapeCallback& escapeFn = EscapeCallback(), - const Dictionary::Ptr& resolvedMacros = Dictionary::Ptr(), + const Dictionary::Ptr& resolvedMacros = nullptr, bool useResolvedMacros = false, int recursionLevel = 0); static Value ResolveArguments(const Value& command, const Dictionary::Ptr& arguments, diff --git a/lib/icinga/notification.cpp b/lib/icinga/notification.cpp index 1738bd359..fccd2cb9f 100644 --- a/lib/icinga/notification.cpp +++ b/lib/icinga/notification.cpp @@ -431,7 +431,7 @@ void Notification::BeginExecuteNotification(NotificationType type, const CheckRe notifiedProblemUsers->Clear(); /* used in db_ido for notification history */ - Service::OnNotificationSentToAllUsers(this, checkable, allNotifiedUsers, type, cr, author, text, MessageOrigin::Ptr()); + Service::OnNotificationSentToAllUsers(this, checkable, allNotifiedUsers, type, cr, author, text, nullptr); } bool Notification::CheckNotificationUserFilters(NotificationType type, const User::Ptr& user, bool force, bool reminder) @@ -518,7 +518,7 @@ void Notification::ExecuteNotificationHelper(NotificationType type, const User:: command->Execute(this, user, cr, type, author, text); /* required by compatlogger */ - Service::OnNotificationSentToUser(this, GetCheckable(), user, type, cr, author, text, command->GetName(), MessageOrigin::Ptr()); + Service::OnNotificationSentToUser(this, GetCheckable(), user, type, cr, author, text, command->GetName(), nullptr); Log(LogInformation, "Notification") << "Completed sending '" << NotificationTypeToStringInternal(type) diff --git a/lib/icinga/notification.ti b/lib/icinga/notification.ti index 442146ec5..d4a454aae 100644 --- a/lib/icinga/notification.ti +++ b/lib/icinga/notification.ti @@ -79,7 +79,7 @@ class Notification : CustomVarObject < NotificationNameComposer }}} navigate {{{ if (GetServiceName().IsEmpty()) - return Service::Ptr(); + return nullptr; Host::Ptr host = Host::GetByName(GetHostName()); return host->GetServiceByShortName(GetServiceName()); diff --git a/lib/icinga/notificationcommand.hpp b/lib/icinga/notificationcommand.hpp index c059aea3a..21cf6c390 100644 --- a/lib/icinga/notificationcommand.hpp +++ b/lib/icinga/notificationcommand.hpp @@ -42,7 +42,7 @@ public: virtual Dictionary::Ptr Execute(const intrusive_ptr& notification, const User::Ptr& user, const CheckResult::Ptr& cr, const NotificationType& type, const String& author, const String& comment, - const Dictionary::Ptr& resolvedMacros = Dictionary::Ptr(), + const Dictionary::Ptr& resolvedMacros = nullptr, bool useResolvedMacros = false); }; diff --git a/lib/icinga/objectutils.cpp b/lib/icinga/objectutils.cpp index bde6cfd9a..94332e097 100644 --- a/lib/icinga/objectutils.cpp +++ b/lib/icinga/objectutils.cpp @@ -51,7 +51,7 @@ Service::Ptr ObjectUtils::GetService(const Value& host, const String& name) hostObj = Host::GetByName(host); if (!hostObj) - return Service::Ptr(); + return nullptr; return hostObj->GetServiceByShortName(name); } @@ -66,7 +66,7 @@ Array::Ptr ObjectUtils::GetServices(const Value& host) hostObj = Host::GetByName(host); if (!hostObj) - return Array::Ptr(); + return nullptr; return Array::FromVector(hostObj->GetServices()); } diff --git a/lib/icinga/scheduleddowntime.ti b/lib/icinga/scheduleddowntime.ti index f949edd6c..de71ed861 100644 --- a/lib/icinga/scheduleddowntime.ti +++ b/lib/icinga/scheduleddowntime.ti @@ -58,7 +58,7 @@ class ScheduledDowntime : CustomVarObject < ScheduledDowntimeNameComposer }}} navigate {{{ if (GetServiceName().IsEmpty()) - return Service::Ptr(); + return nullptr; Host::Ptr host = Host::GetByName(GetHostName()); return host->GetServiceByShortName(GetServiceName()); diff --git a/lib/icinga/service.cpp b/lib/icinga/service.cpp index 4426b35d7..4b8f245ea 100644 --- a/lib/icinga/service.cpp +++ b/lib/icinga/service.cpp @@ -111,7 +111,7 @@ Service::Ptr Service::GetByNamePair(const String& hostName, const String& servic Host::Ptr host = Host::GetByName(hostName); if (!host) - return Service::Ptr(); + return nullptr; return host->GetServiceByShortName(serviceName); } else { @@ -274,6 +274,6 @@ std::pair icinga::GetHostService(const Checkable::Ptr& if (service) return std::make_pair(service->GetHost(), service); else - return std::make_pair(static_pointer_cast(checkable), Service::Ptr()); + return std::make_pair(static_pointer_cast(checkable), nullptr); } diff --git a/lib/livestatus/hoststable.cpp b/lib/livestatus/hoststable.cpp index e98a1aa25..9b10b8152 100644 --- a/lib/livestatus/hoststable.cpp +++ b/lib/livestatus/hoststable.cpp @@ -211,7 +211,7 @@ Object::Ptr HostsTable::HostGroupAccessor(const Value& row, LivestatusGroupByTyp if (groupByType == LivestatusGroupByHostGroup) return groupByObject; - return Object::Ptr(); + return nullptr; } Value HostsTable::NameAccessor(const Value& row) @@ -328,7 +328,7 @@ Value HostsTable::NotesExpandedAccessor(const Value& row) { "icinga", IcingaApplication::GetInstance() } }; - return MacroProcessor::ResolveMacros(host->GetNotes(), resolvers, CheckResult::Ptr()); + return MacroProcessor::ResolveMacros(host->GetNotes(), resolvers); } Value HostsTable::NotesUrlAccessor(const Value& row) diff --git a/lib/livestatus/livestatusquery.cpp b/lib/livestatus/livestatusquery.cpp index 6dbb52c9a..71d7402db 100644 --- a/lib/livestatus/livestatusquery.cpp +++ b/lib/livestatus/livestatusquery.cpp @@ -320,7 +320,7 @@ Filter::Ptr LivestatusQuery::ParseFilter(const String& params, unsigned long& fr tokens.push_back(""); if (tokens.size() < 3) - return Filter::Ptr(); + return nullptr; bool negate = false; String attr = tokens[0]; diff --git a/lib/livestatus/logtable.cpp b/lib/livestatus/logtable.cpp index 73cf8deaa..938660957 100644 --- a/lib/livestatus/logtable.cpp +++ b/lib/livestatus/logtable.cpp @@ -117,7 +117,7 @@ Object::Ptr LogTable::HostAccessor(const Value& row, const Column::ObjectAccesso String host_name = static_cast(row)->Get("host_name"); if (host_name.IsEmpty()) - return Object::Ptr(); + return nullptr; return Host::GetByName(host_name); } @@ -128,7 +128,7 @@ Object::Ptr LogTable::ServiceAccessor(const Value& row, const Column::ObjectAcce String service_description = static_cast(row)->Get("service_description"); if (service_description.IsEmpty() || host_name.IsEmpty()) - return Object::Ptr(); + return nullptr; return Service::GetByNamePair(host_name, service_description); } @@ -138,7 +138,7 @@ Object::Ptr LogTable::ContactAccessor(const Value& row, const Column::ObjectAcce String contact_name = static_cast(row)->Get("contact_name"); if (contact_name.IsEmpty()) - return Object::Ptr(); + return nullptr; return User::GetByName(contact_name); } @@ -148,7 +148,7 @@ Object::Ptr LogTable::CommandAccessor(const Value& row, const Column::ObjectAcce String command_name = static_cast(row)->Get("command_name"); if (command_name.IsEmpty()) - return Object::Ptr(); + return nullptr; CheckCommand::Ptr check_command = CheckCommand::GetByName(command_name); if (!check_command) { @@ -156,7 +156,7 @@ Object::Ptr LogTable::CommandAccessor(const Value& row, const Column::ObjectAcce if (!event_command) { NotificationCommand::Ptr notification_command = NotificationCommand::GetByName(command_name); if (!notification_command) - return Object::Ptr(); + return nullptr; else return notification_command; } else diff --git a/lib/livestatus/servicestable.cpp b/lib/livestatus/servicestable.cpp index 76baa3bca..b58d4c6ce 100644 --- a/lib/livestatus/servicestable.cpp +++ b/lib/livestatus/servicestable.cpp @@ -206,7 +206,7 @@ Object::Ptr ServicesTable::HostAccessor(const Value& row, const Column::ObjectAc Service::Ptr svc = static_cast(service); if (!svc) - return Object::Ptr(); + return nullptr; return svc->GetHost(); } @@ -220,7 +220,7 @@ Object::Ptr ServicesTable::ServiceGroupAccessor(const Value& row, LivestatusGrou if (groupByType == LivestatusGroupByServiceGroup) return groupByObject; - return Object::Ptr(); + return nullptr; } Object::Ptr ServicesTable::HostGroupAccessor(const Value& row, LivestatusGroupByType groupByType, const Object::Ptr& groupByObject) @@ -232,7 +232,7 @@ Object::Ptr ServicesTable::HostGroupAccessor(const Value& row, LivestatusGroupBy if (groupByType == LivestatusGroupByHostGroup) return groupByObject; - return Object::Ptr(); + return nullptr; } Value ServicesTable::ShortNameAccessor(const Value& row) diff --git a/lib/livestatus/statehisttable.cpp b/lib/livestatus/statehisttable.cpp index b8728472a..996464690 100644 --- a/lib/livestatus/statehisttable.cpp +++ b/lib/livestatus/statehisttable.cpp @@ -281,7 +281,7 @@ Object::Ptr StateHistTable::HostAccessor(const Value& row, const Column::ObjectA String host_name = static_cast(row)->Get("host_name"); if (host_name.IsEmpty()) - return Object::Ptr(); + return nullptr; return Host::GetByName(host_name); } @@ -292,7 +292,7 @@ Object::Ptr StateHistTable::ServiceAccessor(const Value& row, const Column::Obje String service_description = static_cast(row)->Get("service_description"); if (service_description.IsEmpty() || host_name.IsEmpty()) - return Object::Ptr(); + return nullptr; return Service::GetByNamePair(host_name, service_description); } diff --git a/lib/livestatus/table.cpp b/lib/livestatus/table.cpp index 1e121ecb1..dcb532374 100644 --- a/lib/livestatus/table.cpp +++ b/lib/livestatus/table.cpp @@ -84,7 +84,7 @@ Table::Ptr Table::GetByName(const String& name, const String& compat_log_path, c else if (name == "zones") return new ZonesTable(); - return Table::Ptr(); + return nullptr; } void Table::AddColumn(const String& name, const Column& column) diff --git a/lib/remote/actionshandler.cpp b/lib/remote/actionshandler.cpp index f6dcba79e..4995a1f04 100644 --- a/lib/remote/actionshandler.cpp +++ b/lib/remote/actionshandler.cpp @@ -69,7 +69,7 @@ bool ActionsHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& reques } } else { FilterUtility::CheckPermission(user, permission); - objs.push_back(ConfigObject::Ptr()); + objs.push_back(nullptr); } Array::Ptr results = new Array(); diff --git a/lib/remote/apiclient.cpp b/lib/remote/apiclient.cpp index 8e91669f5..124c5b9d1 100644 --- a/lib/remote/apiclient.cpp +++ b/lib/remote/apiclient.cpp @@ -322,7 +322,7 @@ void ApiClient::AutocompleteScript(const String& session, const String& command, req->AddHeader("Accept", "application/json"); m_Connection->SubmitRequest(req, std::bind(AutocompleteScriptHttpCompletionCallback, _1, _2, callback)); } catch (const std::exception& ex) { - callback(boost::current_exception(), Array::Ptr()); + callback(boost::current_exception(), nullptr); } } @@ -363,6 +363,6 @@ void ApiClient::AutocompleteScriptHttpCompletionCallback(HttpRequest& request, callback(boost::exception_ptr(), suggestions); } catch (const std::exception& ex) { - callback(boost::current_exception(), Array::Ptr()); + callback(boost::current_exception(), nullptr); } } diff --git a/lib/remote/apilistener-configsync.cpp b/lib/remote/apilistener-configsync.cpp index c2065d87a..393459048 100644 --- a/lib/remote/apilistener-configsync.cpp +++ b/lib/remote/apilistener-configsync.cpp @@ -425,7 +425,7 @@ void ApiListener::SendRuntimeConfigObjects(const JsonRpcConnection::Ptr& aclient continue; /* send the config object to the connected client */ - UpdateConfigObject(object, MessageOrigin::Ptr(), aclient); + UpdateConfigObject(object, nullptr, aclient); } } diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp index 6e964c921..0cf810868 100644 --- a/lib/remote/apilistener.cpp +++ b/lib/remote/apilistener.cpp @@ -279,7 +279,7 @@ Endpoint::Ptr ApiListener::GetMaster(void) const Zone::Ptr zone = Zone::GetLocalZone(); if (!zone) - return Endpoint::Ptr(); + return nullptr; std::vector names; @@ -568,10 +568,10 @@ void ApiListener::SyncClient(const JsonRpcConnection::Ptr& aclient, const Endpoi Log(LogInformation, "ApiListener") << "Requesting new certificate for this Icinga instance from endpoint '" << endpoint->GetName() << "'."; - JsonRpcConnection::SendCertificateRequest(aclient, MessageOrigin::Ptr(), String()); + JsonRpcConnection::SendCertificateRequest(aclient, nullptr, String()); if (Utility::PathExists(ApiListener::GetCertificateRequestsDir())) - Utility::Glob(ApiListener::GetCertificateRequestsDir() + "/*.json", std::bind(&JsonRpcConnection::SendCertificateRequest, aclient, MessageOrigin::Ptr(), _1), GlobFile); + Utility::Glob(ApiListener::GetCertificateRequestsDir() + "/*.json", std::bind(&JsonRpcConnection::SendCertificateRequest, aclient, nullptr, _1), GlobFile); } /* Make sure that the config updates are synced diff --git a/lib/remote/apilistener.hpp b/lib/remote/apilistener.hpp index d258b6488..052209319 100644 --- a/lib/remote/apilistener.hpp +++ b/lib/remote/apilistener.hpp @@ -176,9 +176,9 @@ private: /* configsync */ void UpdateConfigObject(const ConfigObject::Ptr& object, const MessageOrigin::Ptr& origin, - const JsonRpcConnection::Ptr& client = JsonRpcConnection::Ptr()); + const JsonRpcConnection::Ptr& client = nullptr); void DeleteConfigObject(const ConfigObject::Ptr& object, const MessageOrigin::Ptr& origin, - const JsonRpcConnection::Ptr& client = JsonRpcConnection::Ptr()); + const JsonRpcConnection::Ptr& client = nullptr); void SendRuntimeConfigObjects(const JsonRpcConnection::Ptr& aclient); void SyncClient(const JsonRpcConnection::Ptr& aclient, const Endpoint::Ptr& endpoint, bool needSync); diff --git a/lib/remote/apiuser.cpp b/lib/remote/apiuser.cpp index fd4aec9a5..7c0989834 100644 --- a/lib/remote/apiuser.cpp +++ b/lib/remote/apiuser.cpp @@ -32,5 +32,5 @@ ApiUser::Ptr ApiUser::GetByClientCN(const String& cn) return user; } - return ApiUser::Ptr(); + return nullptr; } diff --git a/lib/remote/configpackageutility.hpp b/lib/remote/configpackageutility.hpp index a06eb33f7..3561bdf79 100644 --- a/lib/remote/configpackageutility.hpp +++ b/lib/remote/configpackageutility.hpp @@ -46,7 +46,7 @@ public: static std::vector GetPackages(void); static bool PackageExists(const String& name); - static String CreateStage(const String& packageName, const Dictionary::Ptr& files = Dictionary::Ptr()); + static String CreateStage(const String& packageName, const Dictionary::Ptr& files = nullptr); static void DeleteStage(const String& packageName, const String& stageName); static std::vector GetStages(const String& packageName); static String GetActiveStage(const String& packageName); diff --git a/lib/remote/endpoint.cpp b/lib/remote/endpoint.cpp index e922cd09c..38aeb4fc3 100644 --- a/lib/remote/endpoint.cpp +++ b/lib/remote/endpoint.cpp @@ -113,7 +113,7 @@ Endpoint::Ptr Endpoint::GetLocalEndpoint(void) ApiListener::Ptr listener = ApiListener::GetInstance(); if (!listener) - return Endpoint::Ptr(); + return nullptr; return listener->GetLocalEndpoint(); } diff --git a/lib/remote/eventqueue.cpp b/lib/remote/eventqueue.cpp index 77c1eec0f..5681214a2 100644 --- a/lib/remote/eventqueue.cpp +++ b/lib/remote/eventqueue.cpp @@ -115,11 +115,10 @@ Dictionary::Ptr EventQueue::WaitForEvent(void *client, double timeout) } if (!m_CV.timed_wait(lock, boost::posix_time::milliseconds(timeout * 1000))) - return Dictionary::Ptr(); + return nullptr; } } - std::vector EventQueue::GetQueuesForType(const String& type) { EventQueueRegistry::ItemMap queues = EventQueueRegistry::GetInstance()->GetItems(); diff --git a/lib/remote/filterutility.cpp b/lib/remote/filterutility.cpp index 24881284b..fbe0e0f29 100644 --- a/lib/remote/filterutility.cpp +++ b/lib/remote/filterutility.cpp @@ -33,7 +33,7 @@ Type::Ptr FilterUtility::TypeFromPluralName(const String& pluralName) String uname = pluralName; boost::algorithm::to_lower(uname); - for (const Type::Ptr&type : Type::GetAllTypes()) { + for (const Type::Ptr& type : Type::GetAllTypes()) { String pname = type->GetPluralName(); boost::algorithm::to_lower(pname); @@ -41,7 +41,7 @@ Type::Ptr FilterUtility::TypeFromPluralName(const String& pluralName) return type; } - return Type::Ptr(); + return nullptr; } void ConfigObjectTargetProvider::FindTargets(const String& type, const std::function& addTarget) const diff --git a/lib/remote/httpserverconnection.cpp b/lib/remote/httpserverconnection.cpp index 53e6f7af7..43c8d0f27 100644 --- a/lib/remote/httpserverconnection.cpp +++ b/lib/remote/httpserverconnection.cpp @@ -82,7 +82,7 @@ void HttpServerConnection::Disconnect(void) listener->RemoveHttpClient(this); m_CurrentRequest.~HttpRequest(); - new (&m_CurrentRequest) HttpRequest(Stream::Ptr()); + new (&m_CurrentRequest) HttpRequest(nullptr); m_Stream->Close(); } diff --git a/lib/remote/jsonrpcconnection-pki.cpp b/lib/remote/jsonrpcconnection-pki.cpp index 6f5a5214d..0d108105e 100644 --- a/lib/remote/jsonrpcconnection-pki.cpp +++ b/lib/remote/jsonrpcconnection-pki.cpp @@ -215,7 +215,7 @@ delayed_request: Utility::SaveJsonFile(requestPath, 0600, request); - JsonRpcConnection::SendCertificateRequest(JsonRpcConnection::Ptr(), origin, requestPath); + JsonRpcConnection::SendCertificateRequest(nullptr, origin, requestPath); result->Set("status_code", 2); result->Set("error", "Certificate request for CN '" + cn + "' is pending. Waiting for approval from the parent Icinga instance."); diff --git a/lib/remote/zone.cpp b/lib/remote/zone.cpp index d4660fd75..bb48d1f0e 100644 --- a/lib/remote/zone.cpp +++ b/lib/remote/zone.cpp @@ -139,7 +139,7 @@ Zone::Ptr Zone::GetLocalZone(void) Endpoint::Ptr local = Endpoint::GetLocalEndpoint(); if (!local) - return Zone::Ptr(); + return nullptr; return local->GetZone(); } -- 2.40.0