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 /kms++/src | |
| 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 'kms++/src')
| -rw-r--r-- | kms++/src/card.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
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) |
