diff options
author | Razvan Becheriu <razvan@isc.org> | 2023-12-20 20:06:42 +0100 |
---|---|---|
committer | Razvan Becheriu <razvan@isc.org> | 2024-01-22 16:33:26 +0100 |
commit | 54dd674d0da13aac0cf2ca484842740477276e26 (patch) | |
tree | 884e70409a29a318cf9b038855204a8edbd042b0 /src/lib/util | |
parent | [#3119] Fixed some coverity reported defects (diff) | |
download | kea-54dd674d0da13aac0cf2ca484842740477276e26.tar.xz kea-54dd674d0da13aac0cf2ca484842740477276e26.zip |
[#3119] use auto const& whenever possible
Diffstat (limited to 'src/lib/util')
-rw-r--r-- | src/lib/util/tests/thread_pool_unittest.cc | 4 | ||||
-rw-r--r-- | src/lib/util/thread_pool.h | 4 | ||||
-rw-r--r-- | src/lib/util/unittests/testdata.cc | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/util/tests/thread_pool_unittest.cc b/src/lib/util/tests/thread_pool_unittest.cc index 270deefa1d..0c0df198f6 100644 --- a/src/lib/util/tests/thread_pool_unittest.cc +++ b/src/lib/util/tests/thread_pool_unittest.cc @@ -130,7 +130,7 @@ public: // signal threads that are waiting signalThreads(); // wait for all test threads to exit - for (auto thread : threads_) { + for (const auto& thread : threads_) { thread->join(); } // reset all threads @@ -172,7 +172,7 @@ public: void checkRunHistory(uint32_t items_count) { uint32_t count = 0; // iterate over all threads history and count all the processed tasks - for (auto element : history_) { + for (const auto& element : history_) { count += element.second.size(); } ASSERT_EQ(count, items_count); diff --git a/src/lib/util/thread_pool.h b/src/lib/util/thread_pool.h index 82f6300dfe..379cb93b64 100644 --- a/src/lib/util/thread_pool.h +++ b/src/lib/util/thread_pool.h @@ -242,7 +242,7 @@ private: isc_throw(MultiThreadingInvalidOperation, "thread pool stop called by worker thread"); } queue_.disable(); - for (auto thread : threads_) { + for (const auto& thread : threads_) { thread->join(); } threads_.clear(); @@ -252,7 +252,7 @@ private: /// /// @return true if thread is owned, false otherwise bool checkThreadId(std::thread::id id) { - for (auto thread : threads_) { + for (const auto& thread : threads_) { if (id == thread->get_id()) { return (true); } diff --git a/src/lib/util/unittests/testdata.cc b/src/lib/util/unittests/testdata.cc index e3ecc916db..111cc37204 100644 --- a/src/lib/util/unittests/testdata.cc +++ b/src/lib/util/unittests/testdata.cc @@ -34,8 +34,8 @@ addTestDataPath(const string& path) { void openTestData(const char* const datafile, ifstream& ifs) { - vector<string>::const_iterator it = getDataPaths().begin(); - for (; it != getDataPaths().end(); ++it) { + for (vector<string>::const_iterator it = getDataPaths().begin(); + it != getDataPaths().end(); ++it) { string data_path = *it; if (data_path.empty() || *data_path.rbegin() != '/') { data_path.push_back('/'); |