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

Hanlin Chen hanlinchen at chromium.org
Mon Jun 20 14:08:24 CEST 2022


Hi Laurent,

Reviewed-by: Han-Lin Chen <hanlinchen at chromium.org>
Thanks.

On Fri, Jun 17, 2022 at 9:48 PM Jacopo Mondi via libcamera-devel
<libcamera-devel at lists.libcamera.org> wrote:
>
> Hi Laurent,
>
> On Thu, Jun 16, 2022 at 05:24:00PM +0300, Laurent Pinchart via libcamera-devel wrote:
> > Replace usage of YamlObject::memberNames() with the more efficient
> > iterator API.
> >
> > Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
>
> Nicer indeed. partially answers my "are both dict and list" necessary
> question.
>
> Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>
>
> Thanks
>    j
>
> > ---
> >  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