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. --- utils/kmscapture.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'utils/kmscapture.cpp') diff --git a/utils/kmscapture.cpp b/utils/kmscapture.cpp index 23941ca..251cc3b 100644 --- a/utils/kmscapture.cpp +++ b/utils/kmscapture.cpp @@ -333,7 +333,7 @@ int main(int argc, char** argv) vector camera_fds; - for (string vidpath : glob("/dev/video*")) { + for (const string& vidpath : glob("/dev/video*")) { int fd = ::open(vidpath.c_str(), O_RDWR | O_NONBLOCK); if (fd < 0) -- cgit v1.2.3