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++/src/card.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'kms++') diff --git a/kms++/src/card.cpp b/kms++/src/card.cpp index d0af8a4..c26e4f2 100644 --- a/kms++/src/card.cpp +++ b/kms++/src/card.cpp @@ -70,7 +70,7 @@ static int open_first_kms_device() throw runtime_error("No modesetting DRM card found"); } -static int open_device_by_path(string path) +static int open_device_by_path(const string& path) { int fd = open(path.c_str(), O_RDWR | O_CLOEXEC); if (fd < 0) -- cgit v1.2.3