[2/6] libcamera: matrix: Rename data validation function
diff mbox series

Message ID 20260611011722.1767689-3-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • libcamera: Drop legacy mentions of YAML
Related show

Commit Message

Laurent Pinchart June 11, 2026, 1:17 a.m. UTC
The matrixValidateYaml() function predates the refactoring of YamlObject
and its rename to ValueNode. It now operates on a ValudeNode,
disconnected from the YAML parser. Rename it to
matrixValidateValueNode() accordingly.

While at it, fold consecutive __DOXYGEN__ conditional blocks into a
single one.

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

Comments

Barnabás Pőcze June 15, 2026, 8:16 a.m. UTC | #1
2026. 06. 11. 3:17 keltezéssel, Laurent Pinchart írta:
> The matrixValidateYaml() function predates the refactoring of YamlObject
> and its rename to ValueNode. It now operates on a ValudeNode,
> disconnected from the YAML parser. Rename it to
> matrixValidateValueNode() accordingly.
> 
> While at it, fold consecutive __DOXYGEN__ conditional blocks into a
> single one.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---

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


>   include/libcamera/internal/matrix.h | 6 ++----
>   src/libcamera/matrix.cpp            | 2 +-
>   2 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/include/libcamera/internal/matrix.h b/include/libcamera/internal/matrix.h
> index 0f72263f2536..137eb65e0c52 100644
> --- a/include/libcamera/internal/matrix.h
> +++ b/include/libcamera/internal/matrix.h
> @@ -188,10 +188,8 @@ constexpr Matrix<T, Rows, Cols> operator+(const Matrix<T, Rows, Cols> &m1, const
>   }
>   
>   #ifndef __DOXYGEN__
> -bool matrixValidateYaml(const ValueNode &obj, unsigned int size);
> -#endif /* __DOXYGEN__ */
> +bool matrixValidateValueNode(const ValueNode &obj, unsigned int size);
>   
> -#ifndef __DOXYGEN__
>   template<typename T, unsigned int Rows, unsigned int Cols>
>   std::ostream &operator<<(std::ostream &out, const Matrix<T, Rows, Cols> &m)
>   {
> @@ -203,7 +201,7 @@ template<typename T, unsigned int Rows, unsigned int Cols>
>   struct ValueNode::Accessor<Matrix<T, Rows, Cols>> {
>   	std::optional<Matrix<T, Rows, Cols>> get(const ValueNode &obj) const
>   	{
> -		if (!matrixValidateYaml(obj, Rows * Cols))
> +		if (!matrixValidateValueNode(obj, Rows * Cols))
>   			return std::nullopt;
>   
>   		Matrix<T, Rows, Cols> matrix;
> diff --git a/src/libcamera/matrix.cpp b/src/libcamera/matrix.cpp
> index 4fe210830421..e4fb8d35314d 100644
> --- a/src/libcamera/matrix.cpp
> +++ b/src/libcamera/matrix.cpp
> @@ -314,7 +314,7 @@ template bool matrixInvert<double>(Span<const double> data, Span<double> dataOut
>    * to the product of the number of rows and columns of the matrix (Rows x
>    * Cols). The values shall be stored in row-major order.
>    */
> -bool matrixValidateYaml(const ValueNode &obj, unsigned int size)
> +bool matrixValidateValueNode(const ValueNode &obj, unsigned int size)
>   {
>   	if (!obj.isList())
>   		return false;

Patch
diff mbox series

diff --git a/include/libcamera/internal/matrix.h b/include/libcamera/internal/matrix.h
index 0f72263f2536..137eb65e0c52 100644
--- a/include/libcamera/internal/matrix.h
+++ b/include/libcamera/internal/matrix.h
@@ -188,10 +188,8 @@  constexpr Matrix<T, Rows, Cols> operator+(const Matrix<T, Rows, Cols> &m1, const
 }
 
 #ifndef __DOXYGEN__
-bool matrixValidateYaml(const ValueNode &obj, unsigned int size);
-#endif /* __DOXYGEN__ */
+bool matrixValidateValueNode(const ValueNode &obj, unsigned int size);
 
-#ifndef __DOXYGEN__
 template<typename T, unsigned int Rows, unsigned int Cols>
 std::ostream &operator<<(std::ostream &out, const Matrix<T, Rows, Cols> &m)
 {
@@ -203,7 +201,7 @@  template<typename T, unsigned int Rows, unsigned int Cols>
 struct ValueNode::Accessor<Matrix<T, Rows, Cols>> {
 	std::optional<Matrix<T, Rows, Cols>> get(const ValueNode &obj) const
 	{
-		if (!matrixValidateYaml(obj, Rows * Cols))
+		if (!matrixValidateValueNode(obj, Rows * Cols))
 			return std::nullopt;
 
 		Matrix<T, Rows, Cols> matrix;
diff --git a/src/libcamera/matrix.cpp b/src/libcamera/matrix.cpp
index 4fe210830421..e4fb8d35314d 100644
--- a/src/libcamera/matrix.cpp
+++ b/src/libcamera/matrix.cpp
@@ -314,7 +314,7 @@  template bool matrixInvert<double>(Span<const double> data, Span<double> dataOut
  * to the product of the number of rows and columns of the matrix (Rows x
  * Cols). The values shall be stored in row-major order.
  */
-bool matrixValidateYaml(const ValueNode &obj, unsigned int size)
+bool matrixValidateValueNode(const ValueNode &obj, unsigned int size)
 {
 	if (!obj.isList())
 		return false;