Merge pull request #9555 from Icinga/ApplyRule-GetDebugInfo

ApplyRule#GetDebugInfo(): return by const ref to avoid malloc()
This commit is contained in:
Julian Brost 2022-11-16 13:35:04 +01:00 committed by GitHub
commit a958a735d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 10 deletions

View File

@ -47,7 +47,7 @@ bool ApplyRule::GetIgnoreOnError() const
return m_IgnoreOnError;
}
DebugInfo ApplyRule::GetDebugInfo() const
const DebugInfo& ApplyRule::GetDebugInfo() const
{
return m_DebugInfo;
}

View File

@ -68,7 +68,7 @@ public:
Expression::Ptr GetFTerm() const;
bool GetIgnoreOnError() const;
DebugInfo GetDebugInfo() const;
const DebugInfo& GetDebugInfo() const;
Dictionary::Ptr GetScope() const;
void AddMatch();
bool HasMatches() const;

View File

@ -22,7 +22,7 @@ bool Dependency::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, cons
if (!skipFilter && !rule.EvaluateFilter(frame))
return false;
DebugInfo di = rule.GetDebugInfo();
auto& di (rule.GetDebugInfo());
#ifdef _DEBUG
Log(LogDebug, "Dependency")
@ -64,7 +64,7 @@ bool Dependency::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, cons
bool Dependency::EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyRule& rule, bool skipFilter)
{
DebugInfo di = rule.GetDebugInfo();
auto& di (rule.GetDebugInfo());
std::ostringstream msgbuf;
msgbuf << "Evaluating 'apply' rule (" << di << ")";

View File

@ -22,7 +22,7 @@ bool Notification::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, co
if (!skipFilter && !rule.EvaluateFilter(frame))
return false;
DebugInfo di = rule.GetDebugInfo();
auto& di (rule.GetDebugInfo());
#ifdef _DEBUG
Log(LogDebug, "Notification")
@ -63,7 +63,7 @@ bool Notification::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, co
bool Notification::EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyRule& rule, bool skipFilter)
{
DebugInfo di = rule.GetDebugInfo();
auto& di (rule.GetDebugInfo());
std::ostringstream msgbuf;
msgbuf << "Evaluating 'apply' rule (" << di << ")";

View File

@ -21,7 +21,7 @@ bool ScheduledDowntime::EvaluateApplyRuleInstance(const Checkable::Ptr& checkabl
if (!skipFilter && !rule.EvaluateFilter(frame))
return false;
DebugInfo di = rule.GetDebugInfo();
auto& di (rule.GetDebugInfo());
#ifdef _DEBUG
Log(LogDebug, "ScheduledDowntime")
@ -62,7 +62,7 @@ bool ScheduledDowntime::EvaluateApplyRuleInstance(const Checkable::Ptr& checkabl
bool ScheduledDowntime::EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyRule& rule, bool skipFilter)
{
DebugInfo di = rule.GetDebugInfo();
auto& di (rule.GetDebugInfo());
std::ostringstream msgbuf;
msgbuf << "Evaluating 'apply' rule (" << di << ")";

View File

@ -21,7 +21,7 @@ bool Service::EvaluateApplyRuleInstance(const Host::Ptr& host, const String& nam
if (!skipFilter && !rule.EvaluateFilter(frame))
return false;
DebugInfo di = rule.GetDebugInfo();
auto& di (rule.GetDebugInfo());
#ifdef _DEBUG
Log(LogDebug, "Service")
@ -57,7 +57,7 @@ bool Service::EvaluateApplyRuleInstance(const Host::Ptr& host, const String& nam
bool Service::EvaluateApplyRule(const Host::Ptr& host, const ApplyRule& rule, bool skipFilter)
{
DebugInfo di = rule.GetDebugInfo();
auto& di (rule.GetDebugInfo());
std::ostringstream msgbuf;
msgbuf << "Evaluating 'apply' rule (" << di << ")";