Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ApplyRule#GetDebugInfo(): return by const ref to avoid malloc() #9555

Merged
merged 1 commit into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/config/applyrule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ bool ApplyRule::GetIgnoreOnError() const
return m_IgnoreOnError;
}

DebugInfo ApplyRule::GetDebugInfo() const
const DebugInfo& ApplyRule::GetDebugInfo() const
{
return m_DebugInfo;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/config/applyrule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ApplyRule
String GetFVVar() const;
Expression::Ptr GetFTerm() const;
bool GetIgnoreOnError() const;
DebugInfo GetDebugInfo() const;
const DebugInfo& GetDebugInfo() const;
Dictionary::Ptr GetScope() const;
void AddMatch();
bool HasMatches() const;
Expand Down
4 changes: 2 additions & 2 deletions lib/icinga/dependency-apply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ bool Dependency::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, cons
if (!rule.EvaluateFilter(frame))
return false;

DebugInfo di = rule.GetDebugInfo();
auto& di (rule.GetDebugInfo());

#ifdef _DEBUG
Log(LogDebug, "Dependency")
Expand Down Expand Up @@ -64,7 +64,7 @@ bool Dependency::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, cons

bool Dependency::EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyRule& rule)
{
DebugInfo di = rule.GetDebugInfo();
auto& di (rule.GetDebugInfo());

std::ostringstream msgbuf;
msgbuf << "Evaluating 'apply' rule (" << di << ")";
Expand Down
4 changes: 2 additions & 2 deletions lib/icinga/notification-apply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ bool Notification::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, co
if (!rule.EvaluateFilter(frame))
return false;

DebugInfo di = rule.GetDebugInfo();
auto& di (rule.GetDebugInfo());

#ifdef _DEBUG
Log(LogDebug, "Notification")
Expand Down Expand Up @@ -63,7 +63,7 @@ bool Notification::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, co

bool Notification::EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyRule& rule)
{
DebugInfo di = rule.GetDebugInfo();
auto& di (rule.GetDebugInfo());

std::ostringstream msgbuf;
msgbuf << "Evaluating 'apply' rule (" << di << ")";
Expand Down
4 changes: 2 additions & 2 deletions lib/icinga/scheduleddowntime-apply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ bool ScheduledDowntime::EvaluateApplyRuleInstance(const Checkable::Ptr& checkabl
if (!rule.EvaluateFilter(frame))
return false;

DebugInfo di = rule.GetDebugInfo();
auto& di (rule.GetDebugInfo());

#ifdef _DEBUG
Log(LogDebug, "ScheduledDowntime")
Expand Down Expand Up @@ -62,7 +62,7 @@ bool ScheduledDowntime::EvaluateApplyRuleInstance(const Checkable::Ptr& checkabl

bool ScheduledDowntime::EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyRule& rule)
{
DebugInfo di = rule.GetDebugInfo();
auto& di (rule.GetDebugInfo());

std::ostringstream msgbuf;
msgbuf << "Evaluating 'apply' rule (" << di << ")";
Expand Down
4 changes: 2 additions & 2 deletions lib/icinga/service-apply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ bool Service::EvaluateApplyRuleInstance(const Host::Ptr& host, const String& nam
if (!rule.EvaluateFilter(frame))
return false;

DebugInfo di = rule.GetDebugInfo();
auto& di (rule.GetDebugInfo());

#ifdef _DEBUG
Log(LogDebug, "Service")
Expand Down Expand Up @@ -57,7 +57,7 @@ bool Service::EvaluateApplyRuleInstance(const Host::Ptr& host, const String& nam

bool Service::EvaluateApplyRule(const Host::Ptr& host, const ApplyRule& rule)
{
DebugInfo di = rule.GetDebugInfo();
auto& di (rule.GetDebugInfo());

std::ostringstream msgbuf;
msgbuf << "Evaluating 'apply' rule (" << di << ")";
Expand Down