[PATCH v2 1/3] libcamera: framebuffer_allocator: Move from argument in constructor

Kieran Bingham kieran.bingham at ideasonboard.com
Mon Mar 11 15:14:25 CET 2024


Quoting Barnabás Pőcze (2024-03-10 14:30:33)
> The single argument, of type `std::shared_ptr<Camera>`,
> is passed by value, so it can simply be moved from in order to
> avoid calling the copy constructor.
> 


Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

> Signed-off-by: Barnabás Pőcze <pobrn at protonmail.com>
> ---
>  src/libcamera/framebuffer_allocator.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/framebuffer_allocator.cpp b/src/libcamera/framebuffer_allocator.cpp
> index 94389735..8cf45ab2 100644
> --- a/src/libcamera/framebuffer_allocator.cpp
> +++ b/src/libcamera/framebuffer_allocator.cpp
> @@ -59,7 +59,7 @@ LOG_DEFINE_CATEGORY(Allocator)
>   * \param[in] camera The camera
>   */
>  FrameBufferAllocator::FrameBufferAllocator(std::shared_ptr<Camera> camera)
> -       : camera_(camera)
> +       : camera_(std::move(camera))
>  {
>  }
>  
> -- 
> 2.44.0
> 
>


More information about the libcamera-devel mailing list