diff options
author | fynnwilliam <fynnwilliam@gmail.com> | 2022-06-25 23:28:47 -0400 |
---|---|---|
committer | fynnwilliam <fynnwilliam@gmail.com> | 2022-06-25 23:29:33 -0400 |
commit | 0c4d18be3faff0bfc1c8cfbbc26ad4037f3dac12 (patch) | |
tree | cef4ad4821ad3edcfa10ea1da3edf0e5308ba30a /test | |
parent | 98e9062094466a393b122440a323582fecf43b39 (diff) | |
download | vSomeIP-0c4d18be3faff0bfc1c8cfbbc26ad4037f3dac12.tar.gz |
Use reference to prevent copying
Since the variables are marked as const - we are not going to change
them, we may also take them by ref. Which means we just want to see the
variables.
This improves the performance and also helps to generate minimal code.
Diffstat (limited to 'test')
-rw-r--r-- | test/client_id_tests/client_id_test_utility.cpp | 4 | ||||
-rw-r--r-- | test/npdu_tests/npdu_test_service.cpp | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/test/client_id_tests/client_id_test_utility.cpp b/test/client_id_tests/client_id_test_utility.cpp index 189bb65..9cfe5ab 100644 --- a/test/client_id_tests/client_id_test_utility.cpp +++ b/test/client_id_tests/client_id_test_utility.cpp @@ -312,7 +312,7 @@ TEST_F(client_id_utility_test, exhaust_client_id_range_sequential) { EXPECT_EQ(VSOMEIP_CLIENT_UNSET, vsomeip::utility::request_client_id( configuration_, APPLICATION_NAME_NOT_PREDEFINED + "max", VSOMEIP_CLIENT_UNSET)); - for (const auto c : its_clients) { + for (const auto& c : its_clients) { utility::release_client_id(c); } } @@ -396,7 +396,7 @@ TEST_F(client_id_utility_test, exhaust_client_id_range_fragmented) { VSOMEIP_CLIENT_UNSET)); // release all - for (const auto c : its_clients) { + for (const auto& c : its_clients) { utility::release_client_id(c); } its_clients.clear(); diff --git a/test/npdu_tests/npdu_test_service.cpp b/test/npdu_tests/npdu_test_service.cpp index 901084b..ccbdd66 100644 --- a/test/npdu_tests/npdu_test_service.cpp +++ b/test/npdu_tests/npdu_test_service.cpp @@ -92,7 +92,7 @@ void npdu_test_service::stop() VSOMEIP_INFO << "Stopping..."; if (!undershot_debounce_times_.empty()) { std::chrono::microseconds sum(0); - for (const auto t : undershot_debounce_times_) { + for (const auto& t : undershot_debounce_times_) { sum += t; } double average = static_cast<double>(sum.count())/static_cast<double>(undershot_debounce_times_.size()); |