From 14b262dacf363cc31dc4af64af5893bde017479f Mon Sep 17 00:00:00 2001 From: Hirokazu Honda Date: Wed, 24 Mar 2021 16:07:54 +0900 Subject: android: CameraDevice: Return const shared_ptr& by camera() CameraDevice::camera() originally returns shared_ptr. It is mandatory to make a copy by calling camera() in this way. There is no need of copying if a caller needs the reference of the camera like const shared_ptr &cam = camera(). That is, it is a caller that copying is required. This changes the return type of camera() to const shared_ptr&, so that we are able to reduce one redundant copy in the above case. Signed-off-by: Hirokazu Honda Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- src/android/camera_device.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/android/camera_device.h b/src/android/camera_device.h index 555b33e7..14e26b4d 100644 --- a/src/android/camera_device.h +++ b/src/android/camera_device.h @@ -43,7 +43,7 @@ public: unsigned int id() const { return id_; } camera3_device_t *camera3Device() { return &camera3Device_; } - std::shared_ptr camera() const { return camera_; } + const std::shared_ptr &camera() const { return camera_; } libcamera::CameraConfiguration *cameraConfiguration() const { return config_.get(); -- cgit v1.2.1