Fix performance-for-range-copy warnings
Bug: 30413223
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,performance*
Change-Id: I800b659c039c54fd52a927a88904d642604722f7
diff --git a/modules/input/evdev/InputHub.cpp b/modules/input/evdev/InputHub.cpp
index af7b28e..d22fc88 100644
--- a/modules/input/evdev/InputHub.cpp
+++ b/modules/input/evdev/InputHub.cpp
@@ -495,7 +495,7 @@
status_t InputHub::unregisterDevicePath(const std::string& path) {
int wd = -1;
- for (auto pair : mWatchedPaths) {
+ for (const auto& pair : mWatchedPaths) {
if (pair.second == path) {
wd = pair.first;
break;
@@ -781,7 +781,7 @@
}
status_t InputHub::closeNode(const InputDeviceNode* node) {
- for (auto pair : mDeviceNodes) {
+ for (const auto& pair : mDeviceNodes) {
if (pair.second.get() == node) {
return closeNodeByFd(pair.first);
}
@@ -801,7 +801,7 @@
}
std::shared_ptr<InputDeviceNode> InputHub::findNodeByPath(const std::string& path) {
- for (auto pair : mDeviceNodes) {
+ for (const auto& pair : mDeviceNodes) {
if (pair.second->getPath() == path) return pair.second;
}
return nullptr;