[PATCH] libcamera: yaml_parser: Improve efficiency of string empty check
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Sun Dec 15 23:39:47 CET 2024
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>
---
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
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list