mirror of
https://github.com/esphome/esphome.git
synced 2025-08-10 12:27:46 +00:00
[bluetooth_proxy] Replace std::find with simple loop for small fixed array (#10102)
This commit is contained in:
@@ -80,9 +80,11 @@ void BluetoothConnection::dump_config() {
|
|||||||
|
|
||||||
void BluetoothConnection::update_allocated_slot_(uint64_t find_value, uint64_t set_value) {
|
void BluetoothConnection::update_allocated_slot_(uint64_t find_value, uint64_t set_value) {
|
||||||
auto &allocated = this->proxy_->connections_free_response_.allocated;
|
auto &allocated = this->proxy_->connections_free_response_.allocated;
|
||||||
auto *it = std::find(allocated.begin(), allocated.end(), find_value);
|
for (auto &slot : allocated) {
|
||||||
if (it != allocated.end()) {
|
if (slot == find_value) {
|
||||||
*it = set_value;
|
slot = set_value;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user