diff options
| author | Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> | 2025-09-13 17:42:04 +0300 |
|---|---|---|
| committer | Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> | 2025-12-18 12:23:57 +0200 |
| commit | 9c67dae2d2e6f977e7dc8c5ed070e2bc07383c8a (patch) | |
| tree | 9a8cc37b8003d28be9262ef9218f9407d255beac /utils/kmscapture.cpp | |
| parent | 7cc1bdd06e68ab81612e8feee2a1dedf0e392886 (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 'utils/kmscapture.cpp')
| -rw-r--r-- | utils/kmscapture.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
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<int> 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) |
