summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-05-26 15:46:04 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-05-27 16:06:21 +0300
commit7d1f03e5baaa783eeb0587bbbf319eacc1383ab7 (patch)
tree962d8ef11503954d215b12954d0074727fd5fc6b
parentb7ce7e1d342a5f278e6688e23132526f12b728a2 (diff)
libcamera: media_device: Return string references to avoid copies
The MediaDevice::driver(), deviceNode() and model() functions return a const std::string, copying the string stored internally in the class. Return references instead to avoid copies. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
-rw-r--r--include/libcamera/internal/media_device.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/libcamera/internal/media_device.h b/include/libcamera/internal/media_device.h
index 6e2a63f3..eb8cfde4 100644
--- a/include/libcamera/internal/media_device.h
+++ b/include/libcamera/internal/media_device.h
@@ -38,9 +38,9 @@ public:
int populate();
bool isValid() const { return valid_; }
- const std::string driver() const { return driver_; }
- const std::string deviceNode() const { return deviceNode_; }
- const std::string model() const { return model_; }
+ const std::string &driver() const { return driver_; }
+ const std::string &deviceNode() const { return deviceNode_; }
+ const std::string &model() const { return model_; }
unsigned int version() const { return version_; }
unsigned int hwRevision() const { return hwRevision_; }