Skip to content

Commit 47db320

Browse files
committed
Don't use C++ 17 features/syntax
1 parent 080fced commit 47db320

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

lib/base/dependencygraph.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@ DependencyGraph::DependencyMap DependencyGraph::m_Dependencies;
1010
void DependencyGraph::AddDependency(ConfigObject* child, ConfigObject* parent)
1111
{
1212
std::unique_lock<std::mutex> lock(m_Mutex);
13-
if (auto [it, inserted] = m_Dependencies.insert(Edge(parent, child)); !inserted) {
14-
m_Dependencies.modify(it, [](Edge& e) { e.count++; });
13+
auto pair = m_Dependencies.insert(Edge(parent, child));
14+
if (!pair.second) {
15+
m_Dependencies.modify(pair.first, [](Edge& e) { e.count++; });
1516
}
1617
}
1718

1819
void DependencyGraph::RemoveDependency(ConfigObject* child, ConfigObject* parent)
1920
{
2021
std::unique_lock<std::mutex> lock(m_Mutex);
2122

22-
if (auto it(m_Dependencies.find(Edge(parent, child))); it != m_Dependencies.end()) {
23+
auto it(m_Dependencies.find(Edge(parent, child)));
24+
if (it != m_Dependencies.end()) {
2325
if (it->count > 1) {
2426
// Remove a duplicate edge from child to node, i.e. decrement the corresponding counter.
2527
m_Dependencies.modify(it, [](Edge& e) { e.count--; });

lib/remote/apilistener-configsync.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,8 @@ void ApiListener::SendRuntimeConfigObjects(const JsonRpcConnection::Ptr& aclient
501501

502502
std::unordered_set<ConfigObject*> syncedObjects;
503503
for (const Type::Ptr& type : Type::GetAllTypes()) {
504-
if (auto *ctype = dynamic_cast<ConfigType *>(type.get())) {
504+
auto *ctype = dynamic_cast<ConfigType *>(type.get());
505+
if (ctype) {
505506
for (const auto& object : ctype->GetObjects()) {
506507
// All objects must be synced sorted by their dependency graph.
507508
// Otherwise, downtimes/comments etc. might get synced before their respective Checkables, which will

0 commit comments

Comments
 (0)