[PATCH] libcamera: yaml_parser: Improve efficiency of string empty check
Paul Elder
paul.elder at ideasonboard.com
Mon Dec 16 07:49:47 CET 2024
On Mon, Dec 16, 2024 at 12:39:47AM +0200, Laurent Pinchart wrote:
> Comparing a std::string to an empty string literal is more complex than
> using the std::string::empty() function. Improve the code efficiency by
> replacing the former with the latter.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder at ideasonboard.com>
> ---
> src/libcamera/yaml_parser.cpp | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp
> index 5ca5fb8235b5e761..a5e424615c263f2d 100644
> --- a/src/libcamera/yaml_parser.cpp
> +++ b/src/libcamera/yaml_parser.cpp
> @@ -194,7 +194,7 @@ YamlObject::Getter<double>::get(const YamlObject &obj) const
> if (obj.type_ != Type::Value)
> return std::nullopt;
>
> - if (obj.value_ == "")
> + if (obj.value_.empty())
> return std::nullopt;
>
> char *end;
>
> base-commit: 8e15010b7dfa9c2a68dd57f924b5603784be0e09
More information about the libcamera-devel
mailing list