From 4ceda31f320461cceea6e5ece1ddf6b0eeeac1e7 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 6 Aug 2025 09:53:42 -1000 Subject: [PATCH] [bluetooth_proxy] Replace std::find with simple loop for small fixed array (#10102) --- .../components/bluetooth_proxy/bluetooth_connection.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/esphome/components/bluetooth_proxy/bluetooth_connection.cpp b/esphome/components/bluetooth_proxy/bluetooth_connection.cpp index 23b73127d9..9bf78c866b 100644 --- a/esphome/components/bluetooth_proxy/bluetooth_connection.cpp +++ b/esphome/components/bluetooth_proxy/bluetooth_connection.cpp @@ -80,9 +80,11 @@ void BluetoothConnection::dump_config() { void BluetoothConnection::update_allocated_slot_(uint64_t find_value, uint64_t set_value) { auto &allocated = this->proxy_->connections_free_response_.allocated; - auto *it = std::find(allocated.begin(), allocated.end(), find_value); - if (it != allocated.end()) { - *it = set_value; + for (auto &slot : allocated) { + if (slot == find_value) { + slot = set_value; + return; + } } }