mirror of https://github.com/Icinga/icinga2.git
Code style
This commit is contained in:
parent
396a71c6a0
commit
35248b1b63
|
@ -96,15 +96,11 @@ bool Checkable::IsReachable(DependencyType dt, Dependency::Ptr *failedDependency
|
||||||
// note that std::unordered_map::insert() will not overwrite an existing entry
|
// note that std::unordered_map::insert() will not overwrite an existing entry
|
||||||
violated.insert(std::make_pair(redundancy_group, dep));
|
violated.insert(std::make_pair(redundancy_group, dep));
|
||||||
} else if (!redundancy_group.empty()) {
|
} else if (!redundancy_group.empty()) {
|
||||||
// definitely mark this dependency group as passed
|
violated[redundancy_group] = nullptr;
|
||||||
// as std::unordered_map::insert() will not overwrite an existing entry, erase it first
|
|
||||||
// in C++17, one could use std::unorderer_map::insert_or_assign() instead
|
|
||||||
violated.erase(redundancy_group);
|
|
||||||
violated.insert(std::make_pair(redundancy_group, nullptr));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto violator = std::find_if(violated.begin(), violated.end(), [](const std::pair<std::string, Dependency::Ptr>&v) { return v.second != nullptr; });
|
auto violator = std::find_if(violated.begin(), violated.end(), [](auto& v) { return v.second != nullptr; });
|
||||||
if (violator != violated.end()) {
|
if (violator != violated.end()) {
|
||||||
Log(LogDebug, "Checkable")
|
Log(LogDebug, "Checkable")
|
||||||
<< "All dependencies in redundancy group '" << violator->first << "' have failed for checkable '" << GetName() << "': Marking as unreachable.";
|
<< "All dependencies in redundancy group '" << violator->first << "' have failed for checkable '" << GetName() << "': Marking as unreachable.";
|
||||||
|
|
Loading…
Reference in New Issue