Replace range-based for loop with std::fill

Use standard algorithm std::fill instead of manual loop to clear bleKeyMap array. This is more idiomatic C++ and expresses intent more clearly.
This commit is contained in:
Justin Mitchell
2026-06-24 17:15:44 -04:00
parent 568831f232
commit 28d0d6f5d2
4 changed files with 31 additions and 27 deletions
+3 -1
View File
@@ -5,7 +5,9 @@
#include <Logging.h>
#include <ObfuscationUtils.h>
#include <algorithm>
#include <cstring>
#include <iterator>
#include <string>
#include "BookmarkEntry.h"
@@ -256,7 +258,7 @@ bool JsonSettingsIO::loadSettings(CrossPointSettings& s, const char* json, bool*
// Bluetooth — managed by BluetoothSettingsActivity, not in SettingsList.
s.bluetoothEnabled = clamp(doc["bluetoothEnabled"] | (uint8_t)0, 2, 0);
for (auto& e : s.bleKeyMap) e = CrossPointSettings::BleKeyMapEntry{}; // reset to empty
std::fill(std::begin(s.bleKeyMap), std::end(s.bleKeyMap), CrossPointSettings::BleKeyMapEntry{}); // reset to empty
JsonArrayConst bleMap = doc["bleKeyMap"];
if (!bleMap.isNull()) {
uint8_t slot = 0;