fix: optimization: PVS-Studio warning V836

Expression's value is copied at variable declaration.
The variable is never modified. Consider declaring it as a reference.

Changed variables to be a reference to avoid unnecessary copy.

Reported by: PVS-Studio

Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
This commit is contained in:
Vyacheslav Ivanov 2024-08-01 23:35:13 +03:00 committed by Pugemon
parent 50a388c539
commit 73e721513c
No known key found for this signature in database
GPG Key ID: 472FA343B3CC3287
2 changed files with 2 additions and 2 deletions

View File

@ -85,7 +85,7 @@ bool ContentLoader::fixPackIndices(
indexed.push_back(name);
}
}
for (auto name : detected) {
for (const auto &name : detected) {
if (!util::contains(indexed, name)) {
arr->put(name);
modified = true;

View File

@ -203,7 +203,7 @@ static void _readPanel(UiXmlReader& reader, const xml::xmlelement& element, Pane
panel.setMaxLength(element->attr("max-length").asInt());
}
if (element->has("orientation")) {
auto oname = element->attr("orientation").getText();
const auto &oname = element->attr("orientation").getText();
if (oname == "horizontal") {
panel.setOrientation(Orientation::horizontal);
}