mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
fix: optimization: PVS-Studio warning V831
Replaced 'at()' method with 'operator[]' to improve performance. The 'at()' method performs bounds checking, which can introduce overhead. Using 'operator[]' bypasses this check and can improve performance when you are certain that the index is within bounds. Reported by: PVS-Studio Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
This commit is contained in:
parent
1bdc9cf759
commit
f3f872c7a3
6 changed files with 8 additions and 8 deletions
|
|
@ -95,7 +95,7 @@ static int l_pack_get_info(lua::State* L, const ContentPack& pack, const Content
|
|||
if (!pack.dependencies.empty()) {
|
||||
lua::createtable(L, pack.dependencies.size(), 0);
|
||||
for (size_t i = 0; i < pack.dependencies.size(); i++) {
|
||||
auto& dpack = pack.dependencies.at(i);
|
||||
auto& dpack = pack.dependencies[i];
|
||||
std::string prefix;
|
||||
switch (dpack.level) {
|
||||
case DependencyLevel::required: prefix = "!"; break;
|
||||
|
|
@ -142,7 +142,7 @@ static int l_pack_get_info(lua::State* L) {
|
|||
manager.scan();
|
||||
auto vec = manager.getAll({packid});
|
||||
if (!vec.empty()) {
|
||||
return l_pack_get_info(L, vec.at(0), content);
|
||||
return l_pack_get_info(L, vec[0], content);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue