[libcamera-devel,v2,05/14] libcamera: controls: Default ControlList validator argument to nullptr

Message ID 20191012184407.31684-6-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • Use ControlList for both libcamera and V4L2 controls
Related show

Commit Message

Laurent Pinchart Oct. 12, 2019, 6:43 p.m. UTC
The ControlList constructor takes a validator pointer that can be null.
Set its default value to nullptr to simplify code in users of
ControlList.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 include/libcamera/controls.h | 2 +-
 src/ipa/rkisp1/rkisp1.cpp    | 2 +-
 src/libcamera/request.cpp    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Comments

Niklas Söderlund Oct. 13, 2019, 3:31 p.m. UTC | #1
Hi Laurent,

Thanks for your work.

On 2019-10-12 21:43:58 +0300, Laurent Pinchart wrote:
> The ControlList constructor takes a validator pointer that can be null.
> Set its default value to nullptr to simplify code in users of
> ControlList.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

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

> ---
>  include/libcamera/controls.h | 2 +-
>  src/ipa/rkisp1/rkisp1.cpp    | 2 +-
>  src/libcamera/request.cpp    | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
> index 342251c21018..12a13aacb198 100644
> --- a/include/libcamera/controls.h
> +++ b/include/libcamera/controls.h
> @@ -126,7 +126,7 @@ private:
>  	using ControlListMap = std::unordered_map<const ControlId *, ControlValue>;
>  
>  public:
> -	ControlList(ControlValidator *validator);
> +	ControlList(ControlValidator *validator = nullptr);
>  
>  	using iterator = ControlListMap::iterator;
>  	using const_iterator = ControlListMap::const_iterator;
> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
> index 02419e254f2d..80138f196184 100644
> --- a/src/ipa/rkisp1/rkisp1.cpp
> +++ b/src/ipa/rkisp1/rkisp1.cpp
> @@ -220,7 +220,7 @@ void IPARkISP1::setControls(unsigned int frame)
>  
>  void IPARkISP1::metadataReady(unsigned int frame, unsigned int aeState)
>  {
> -	ControlList ctrls(nullptr);
> +	ControlList ctrls;
>  
>  	if (aeState)
>  		ctrls.set(controls::AeLocked, aeState == 2);
> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
> index 23d3ab6f422c..e800f1449888 100644
> --- a/src/libcamera/request.cpp
> +++ b/src/libcamera/request.cpp
> @@ -69,7 +69,7 @@ Request::Request(Camera *camera, uint64_t cookie)
>  	/**
>  	 * \todo: Add a validator for metadata controls.
>  	 */
> -	metadata_ = new ControlList(nullptr);
> +	metadata_ = new ControlList();
>  }
>  
>  Request::~Request()
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch

diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
index 342251c21018..12a13aacb198 100644
--- a/include/libcamera/controls.h
+++ b/include/libcamera/controls.h
@@ -126,7 +126,7 @@  private:
 	using ControlListMap = std::unordered_map<const ControlId *, ControlValue>;
 
 public:
-	ControlList(ControlValidator *validator);
+	ControlList(ControlValidator *validator = nullptr);
 
 	using iterator = ControlListMap::iterator;
 	using const_iterator = ControlListMap::const_iterator;
diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index 02419e254f2d..80138f196184 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -220,7 +220,7 @@  void IPARkISP1::setControls(unsigned int frame)
 
 void IPARkISP1::metadataReady(unsigned int frame, unsigned int aeState)
 {
-	ControlList ctrls(nullptr);
+	ControlList ctrls;
 
 	if (aeState)
 		ctrls.set(controls::AeLocked, aeState == 2);
diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
index 23d3ab6f422c..e800f1449888 100644
--- a/src/libcamera/request.cpp
+++ b/src/libcamera/request.cpp
@@ -69,7 +69,7 @@  Request::Request(Camera *camera, uint64_t cookie)
 	/**
 	 * \todo: Add a validator for metadata controls.
 	 */
-	metadata_ = new ControlList(nullptr);
+	metadata_ = new ControlList();
 }
 
 Request::~Request()