File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,16 +10,18 @@ DependencyGraph::DependencyMap DependencyGraph::m_Dependencies;
1010void 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
1819void 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 --; });
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments