summaryrefslogtreecommitdiff
path: root/kms++util/src/resourcemanager.cpp
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ideasonboard.com>2025-09-13 17:42:04 +0300
committerTomi Valkeinen <tomi.valkeinen@ideasonboard.com>2025-12-18 12:23:57 +0200
commit9c67dae2d2e6f977e7dc8c5ed070e2bc07383c8a (patch)
tree9a8cc37b8003d28be9262ef9218f9407d255beac /kms++util/src/resourcemanager.cpp
parent7cc1bdd06e68ab81612e8feee2a1dedf0e392886 (diff)
perf: Pass parameters by const reference to avoid copies
Fix cppcheck performance warnings by passing function parameters by const reference instead of by value, preventing unnecessary copies: - string parameters in open_device_by_path() - set<Connector*> parameters in connector finder functions - vector parameter in FlipState constructor - range variable in kmscapture loop These changes improve performance by avoiding object copies while maintaining the same functionality.
Diffstat (limited to 'kms++util/src/resourcemanager.cpp')
-rw-r--r--kms++util/src/resourcemanager.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/kms++util/src/resourcemanager.cpp b/kms++util/src/resourcemanager.cpp
index 5a9f016..424c8f0 100644
--- a/kms++util/src/resourcemanager.cpp
+++ b/kms++util/src/resourcemanager.cpp
@@ -17,7 +17,7 @@ void ResourceManager::reset()
m_reserved_planes.clear();
}
-static Connector* find_connector(Card& card, const set<Connector*> reserved)
+static Connector* find_connector(Card& card, const set<Connector*>& reserved)
{
for (Connector* conn : card.get_connectors()) {
if (!conn->connected())
@@ -32,7 +32,7 @@ static Connector* find_connector(Card& card, const set<Connector*> reserved)
return nullptr;
}
-static Connector* resolve_connector(Card& card, const string& name, const set<Connector*> reserved)
+static Connector* resolve_connector(Card& card, const string& name, const set<Connector*>& reserved)
{
auto connectors = card.get_connectors();