From 88968af20ba7332b2de29c3c39e5cafe97a3f127 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Thu, 2 Mar 2017 20:56:19 -0500 Subject: [PATCH] dependency: CPP Core Guidlines compliance --- src/dependency.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/dependency.cpp b/src/dependency.cpp index 6c91a470f..2836bddaf 100644 --- a/src/dependency.cpp +++ b/src/dependency.cpp @@ -57,8 +57,8 @@ std::vector dependencyGetBlocked (const Task& task) std::vector dependencyGetBlocking (const Task& task) { auto depends = task.get ("depends"); - std::vector blocking; + std::vector blocking; if (depends != "") for (auto& it : context.tdb2.pending.get_tasks ()) if (it.getStatus () != Task::completed && @@ -80,9 +80,9 @@ bool dependencyIsCircular (const Task& task) auto task_uuid = task.get ("uuid"); std::stack s; - std::unordered_set visited; - s.push (task); + + std::unordered_set visited; visited.insert (task_uuid); while (! s.empty ()) @@ -164,7 +164,7 @@ void dependencyChainOnComplete (Task& task) std::cout << format (STRING_DEPEND_BLOCKED, task.identifier ()) << '\n'; - for (auto& b : blocking) + for (const auto& b : blocking) std::cout << " " << b.id << ' ' << b.get ("description") << '\n'; } @@ -176,7 +176,7 @@ void dependencyChainOnComplete (Task& task) std::cout << STRING_DEPEND_BLOCKING << '\n'; - for (auto& b : blocked) + for (const auto& b : blocked) std::cout << " " << b.id << ' ' << b.get ("description") << '\n'; } @@ -189,7 +189,7 @@ void dependencyChainOnComplete (Task& task) { left.removeDependency (task.id); - for (auto& right : blocking) + for (const auto& right : blocking) left.addDependency (right.id); } @@ -218,7 +218,7 @@ void dependencyChainOnStart (Task& task) std::cout << format (STRING_DEPEND_BLOCKED, task.identifier ()) << '\n'; - for (auto& b : blocking) + for (const auto& b : blocking) std::cout << " " << b.id << ' ' << b.get ("description") << '\n'; } }