[v2,7/8] apps: cam: drm: Drop unneeded local variable
diff mbox series

Message ID 20250815113400.20623-8-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • libcamera: Use span in FrameBuffer & assorted cleanups
Related show

Commit Message

Laurent Pinchart Aug. 15, 2025, 11:33 a.m. UTC
The planes variable in the Device::createFrameBuffer() function is a
reference to buffer.planes() that is only used as a range initializer in
a range-based for loop. Use buffer.planes() directly and drop the
variable.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/apps/cam/drm.cpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Barnabás Pőcze Aug. 15, 2025, 11:54 a.m. UTC | #1
2025. 08. 15. 13:33 keltezéssel, Laurent Pinchart írta:
> The planes variable in the Device::createFrameBuffer() function is a
> reference to buffer.planes() that is only used as a range initializer in
> a range-based for loop. Use buffer.planes() directly and drop the
> variable.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---

Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>


>   src/apps/cam/drm.cpp | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/src/apps/cam/drm.cpp b/src/apps/cam/drm.cpp
> index f4b47097649a..8e2dfd9a64e4 100644
> --- a/src/apps/cam/drm.cpp
> +++ b/src/apps/cam/drm.cpp
> @@ -659,10 +659,8 @@ std::unique_ptr<FrameBuffer> Device::createFrameBuffer(
>   	uint32_t offsets[4] = {};
>   	int ret;
>   
> -	const std::vector<libcamera::FrameBuffer::Plane> &planes = buffer.planes();
> -
>   	unsigned int i = 0;
> -	for (const libcamera::FrameBuffer::Plane &plane : planes) {
> +	for (const libcamera::FrameBuffer::Plane &plane : buffer.planes()) {
>   		int fd = plane.fd.get();
>   		uint32_t handle;
>
Jacopo Mondi Aug. 19, 2025, 3:32 p.m. UTC | #2
Hi Laurent

On Fri, Aug 15, 2025 at 02:33:59PM +0300, Laurent Pinchart wrote:
> The planes variable in the Device::createFrameBuffer() function is a
> reference to buffer.planes() that is only used as a range initializer in
> a range-based for loop. Use buffer.planes() directly and drop the
> variable.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

Thanks
  j

> ---
>  src/apps/cam/drm.cpp | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/src/apps/cam/drm.cpp b/src/apps/cam/drm.cpp
> index f4b47097649a..8e2dfd9a64e4 100644
> --- a/src/apps/cam/drm.cpp
> +++ b/src/apps/cam/drm.cpp
> @@ -659,10 +659,8 @@ std::unique_ptr<FrameBuffer> Device::createFrameBuffer(
>  	uint32_t offsets[4] = {};
>  	int ret;
>
> -	const std::vector<libcamera::FrameBuffer::Plane> &planes = buffer.planes();
> -
>  	unsigned int i = 0;
> -	for (const libcamera::FrameBuffer::Plane &plane : planes) {
> +	for (const libcamera::FrameBuffer::Plane &plane : buffer.planes()) {
>  		int fd = plane.fd.get();
>  		uint32_t handle;
>
> --
> Regards,
>
> Laurent Pinchart
>

Patch
diff mbox series

diff --git a/src/apps/cam/drm.cpp b/src/apps/cam/drm.cpp
index f4b47097649a..8e2dfd9a64e4 100644
--- a/src/apps/cam/drm.cpp
+++ b/src/apps/cam/drm.cpp
@@ -659,10 +659,8 @@  std::unique_ptr<FrameBuffer> Device::createFrameBuffer(
 	uint32_t offsets[4] = {};
 	int ret;
 
-	const std::vector<libcamera::FrameBuffer::Plane> &planes = buffer.planes();
-
 	unsigned int i = 0;
-	for (const libcamera::FrameBuffer::Plane &plane : planes) {
+	for (const libcamera::FrameBuffer::Plane &plane : buffer.planes()) {
 		int fd = plane.fd.get();
 		uint32_t handle;