[libcamera-devel] [PATCH 4/7] android: Use the YamlObject iterator API

Laurent Pinchart laurent.pinchart at ideasonboard.com
Thu Jun 16 16:24:00 CEST 2022


Replace usage of YamlObject::memberNames() with the more efficient
iterator API.

Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
 src/android/camera_hal_config.cpp | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/android/camera_hal_config.cpp b/src/android/camera_hal_config.cpp
index ac484b8df1bd..bacfe4b9c505 100644
--- a/src/android/camera_hal_config.cpp
+++ b/src/android/camera_hal_config.cpp
@@ -82,10 +82,8 @@ int CameraHalConfig::Private::parseConfigFile(File &file,
 	if (!yamlObjectCameras.isDictionary())
 		return -EINVAL;
 
-	std::vector<std::string> cameraIds = yamlObjectCameras.memberNames();
-	for (const std::string &cameraId : cameraIds) {
-		if (parseCameraConfigData(cameraId,
-					  yamlObjectCameras[cameraId]))
+	for (const auto &[cameraId, configData] : yamlObjectCameras.asDict()) {
+		if (parseCameraConfigData(cameraId, configData))
 			return -EINVAL;
 	}
 
-- 
Regards,

Laurent Pinchart



More information about the libcamera-devel mailing list