diff options
Diffstat (limited to 'src/tasks.cc')
-rw-r--r-- | src/tasks.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/tasks.cc b/src/tasks.cc index 0e59097..2f9e47a 100644 --- a/src/tasks.cc +++ b/src/tasks.cc @@ -8,6 +8,7 @@ #include <list> #include <iostream> #include <algorithm> +#include <span> #include "ctor.h" #include "task.h" @@ -24,20 +25,22 @@ const std::deque<Target>& getTargets(const ctor::settings& settings, bool resolve_externals) { + auto config_files = std::span(configFiles).subspan(0, numConfigFiles); + static bool initialised{false}; static std::deque<Target> targets; if(!initialised) { const auto& externals = ctor::get_configuration().externals; - for(std::size_t i = 0; i < numConfigFiles; ++i) + for(const auto& config_file : config_files) { std::string path = - std::filesystem::path(configFiles[i].file).parent_path().string(); + std::filesystem::path(config_file.file).parent_path().string(); if(settings.verbose > 1) { - std::cout << configFiles[i].file << " in path " << path << "\n"; + std::cout << config_file.file << " in path " << path << "\n"; } - auto configs = configFiles[i].cb(settings); + auto configs = config_file.cb(settings); for(auto& config : configs) { if(resolve_externals) @@ -167,7 +170,7 @@ std::vector<std::shared_ptr<Task>> taskFactory(const ctor::build_configuration& return tasks; } -std::shared_ptr<Task> getNextTask(const std::vector<std::shared_ptr<Task>>& allTasks, +std::shared_ptr<Task> getNextTask([[maybe_unused]]const std::vector<std::shared_ptr<Task>>& allTasks, std::vector<std::shared_ptr<Task>>& dirtyTasks) { for(auto dirtyTask = dirtyTasks.begin(); |