mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
[clang-tidy] Reserve memory for vector loop
Found with performance-inefficient-vector-operation Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
ab170e34df
commit
7f86b29aa9
2 changed files with 2 additions and 0 deletions
|
@ -196,6 +196,7 @@ void Hooks::onExit () const
|
|||
|
||||
// Convert to a vector of strings.
|
||||
std::vector <std::string> input;
|
||||
input.reserve(tasks.size());
|
||||
for (auto& t : tasks)
|
||||
input.push_back (t.composeJSON ());
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ static void countTasks (const std::vector <Task>&, const std::string&, int&, int
|
|||
std::string taskIdentifiers (const std::vector <Task>& tasks)
|
||||
{
|
||||
std::vector <std::string> identifiers;
|
||||
identifiers.reserve(tasks.size());
|
||||
for (const auto& task: tasks)
|
||||
identifiers.push_back (task.identifier (true));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue