From 9c67dae2d2e6f977e7dc8c5ed070e2bc07383c8a Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Sat, 13 Sep 2025 17:42:04 +0300 Subject: 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 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. --- kms++util/src/resourcemanager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'kms++util/src/resourcemanager.cpp') 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 reserved) +static Connector* find_connector(Card& card, const set& reserved) { for (Connector* conn : card.get_connectors()) { if (!conn->connected()) @@ -32,7 +32,7 @@ static Connector* find_connector(Card& card, const set reserved) return nullptr; } -static Connector* resolve_connector(Card& card, const string& name, const set reserved) +static Connector* resolve_connector(Card& card, const string& name, const set& reserved) { auto connectors = card.get_connectors(); -- cgit v1.2.3