From e40b8ee7770d7c2e1287ca213e20db61e2c95b6d Mon Sep 17 00:00:00 2001 From: Pavel Solodovnikov Date: Sun, 7 Jan 2024 21:40:52 +0300 Subject: [PATCH] Use `operator[]` instead of `.at()` for `asFeatureStats` element access Don't use `.at()` method, which performs additional bounds checking in cases where we know upfront that the element exists. Signed-off-by: Pavel Solodovnikov --- src/feature.cpp | 2 +- src/hci.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/feature.cpp b/src/feature.cpp index f14b0318adf..52f2382f4d7 100644 --- a/src/feature.cpp +++ b/src/feature.cpp @@ -73,7 +73,7 @@ bool loadFeatureStats(WzConfig &ini) { ini.beginGroup(list[i]); asFeatureStats.emplace_back(STAT_FEATURE + i); - FEATURE_STATS& p = asFeatureStats.at(i); + FEATURE_STATS& p = asFeatureStats[i]; p.name = ini.string(WzString::fromUtf8("name")); p.id = list[i]; WzString subType = ini.value("type").toWzString(); diff --git a/src/hci.cpp b/src/hci.cpp index 35c7104326b..7b9efeab3e9 100644 --- a/src/hci.cpp +++ b/src/hci.cpp @@ -1272,7 +1272,7 @@ void intOpenDebugMenu(OBJECT_TYPE id) case OBJ_FEATURE: for (unsigned i = 0, end = std::min(asFeatureStats.size(), MAXFEATURES); i < end; ++i) { - apsFeatureList[i] = &asFeatureStats.at(i); + apsFeatureList[i] = &asFeatureStats[i]; } ppsStatsList = (BASE_STATS **)apsFeatureList; intAddDebugStatsForm(ppsStatsList, std::min(asFeatureStats.size(), MAXFEATURES));