[libcamera-devel,v2,05/11] libcamera: pipeline: Use existing variable definitions
diff mbox series

Message ID 20201015223750.58563-6-kieran.bingham@ideasonboard.com
State Accepted
Headers show
Series
  • Shadowed Variables
Related show

Commit Message

Kieran Bingham Oct. 15, 2020, 10:37 p.m. UTC
Prevent variable aliasing by removing the redeclaration of variables
with the same name (and type) where the existing variable can be reused.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 2 +-
 src/libcamera/pipeline/simple/simple.cpp           | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Niklas Söderlund Oct. 15, 2020, 11:20 p.m. UTC | #1
Hi Kieran,

On 2020-10-15 23:37:44 +0100, Kieran Bingham wrote:
> Prevent variable aliasing by removing the redeclaration of variables
> with the same name (and type) where the existing variable can be reused.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 2 +-
>  src/libcamera/pipeline/simple/simple.cpp           | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> index 85e0a1f26ab6..2d70d984a276 100644
> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> @@ -1008,7 +1008,7 @@ int PipelineHandlerRPi::queueAllBuffers(Camera *camera)
>  			 */
>  			unsigned int i;
>  			for (i = 0; i < data->dropFrameCount_; i++) {
> -				int ret = stream->queueBuffer(nullptr);
> +				ret = stream->queueBuffer(nullptr);
>  				if (ret)
>  					return ret;
>  			}
> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
> index 999c44515023..33daa2fb1b7b 100644
> --- a/src/libcamera/pipeline/simple/simple.cpp
> +++ b/src/libcamera/pipeline/simple/simple.cpp
> @@ -612,8 +612,8 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)
>  	useConverter_ = config->needConversion();
>  
>  	if (useConverter_) {
> -		int ret = converter_->configure(pipeConfig.pixelFormat,
> -						pipeConfig.captureSize, &cfg);
> +		ret = converter_->configure(pipeConfig.pixelFormat,
> +					    pipeConfig.captureSize, &cfg);
>  		if (ret < 0) {
>  			LOG(SimplePipeline, Error)
>  				<< "Unable to configure converter";
> -- 
> 2.25.1
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Laurent Pinchart Oct. 16, 2020, 12:42 a.m. UTC | #2
Hi Kieran,

Thank you for the patch.

On Thu, Oct 15, 2020 at 11:37:44PM +0100, Kieran Bingham wrote:
> Prevent variable aliasing by removing the redeclaration of variables
> with the same name (and type) where the existing variable can be reused.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 2 +-
>  src/libcamera/pipeline/simple/simple.cpp           | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> index 85e0a1f26ab6..2d70d984a276 100644
> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> @@ -1008,7 +1008,7 @@ int PipelineHandlerRPi::queueAllBuffers(Camera *camera)
>  			 */
>  			unsigned int i;
>  			for (i = 0; i < data->dropFrameCount_; i++) {
> -				int ret = stream->queueBuffer(nullptr);
> +				ret = stream->queueBuffer(nullptr);
>  				if (ret)
>  					return ret;
>  			}
> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
> index 999c44515023..33daa2fb1b7b 100644
> --- a/src/libcamera/pipeline/simple/simple.cpp
> +++ b/src/libcamera/pipeline/simple/simple.cpp
> @@ -612,8 +612,8 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)
>  	useConverter_ = config->needConversion();
>  
>  	if (useConverter_) {
> -		int ret = converter_->configure(pipeConfig.pixelFormat,
> -						pipeConfig.captureSize, &cfg);
> +		ret = converter_->configure(pipeConfig.pixelFormat,
> +					    pipeConfig.captureSize, &cfg);
>  		if (ret < 0) {
>  			LOG(SimplePipeline, Error)
>  				<< "Unable to configure converter";

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 85e0a1f26ab6..2d70d984a276 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -1008,7 +1008,7 @@  int PipelineHandlerRPi::queueAllBuffers(Camera *camera)
 			 */
 			unsigned int i;
 			for (i = 0; i < data->dropFrameCount_; i++) {
-				int ret = stream->queueBuffer(nullptr);
+				ret = stream->queueBuffer(nullptr);
 				if (ret)
 					return ret;
 			}
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index 999c44515023..33daa2fb1b7b 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -612,8 +612,8 @@  int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)
 	useConverter_ = config->needConversion();
 
 	if (useConverter_) {
-		int ret = converter_->configure(pipeConfig.pixelFormat,
-						pipeConfig.captureSize, &cfg);
+		ret = converter_->configure(pipeConfig.pixelFormat,
+					    pipeConfig.captureSize, &cfg);
 		if (ret < 0) {
 			LOG(SimplePipeline, Error)
 				<< "Unable to configure converter";