[08/36] libcamera: yaml_parser: Use std::make_unique<>
diff mbox series

Message ID 20260113000808.15395-9-laurent.pinchart@ideasonboard.com
State New
Headers show
Series
  • libcamera: Global configuration file improvements
Related show

Commit Message

Laurent Pinchart Jan. 13, 2026, 12:07 a.m. UTC
The YamlParser::parse() function constructs a std::unique_ptr<> instance
with a manual call to operator new. Replace it with std::make_unique<>.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/yaml_parser.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Barnabás Pőcze Jan. 13, 2026, 8:56 a.m. UTC | #1
2026. 01. 13. 1:07 keltezéssel, Laurent Pinchart írta:
> The YamlParser::parse() function constructs a std::unique_ptr<> instance
> with a manual call to operator new. Replace it with std::make_unique<>.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---

Reviewed-by: Barnabás Pőcze <barnabas.pocze@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 a5e424615c26..72580e901ddd 100644
> --- a/src/libcamera/yaml_parser.cpp
> +++ b/src/libcamera/yaml_parser.cpp
> @@ -769,7 +769,7 @@ std::unique_ptr<YamlObject> YamlParser::parse(File &file)
>   	if (context.init(file))
>   		return nullptr;
> 
> -	std::unique_ptr<YamlObject> root(new YamlObject());
> +	std::unique_ptr<YamlObject> root = std::make_unique<YamlObject>();
> 
>   	if (context.parseContent(*root)) {
>   		LOG(YamlParser, Error)
> --
> Regards,
> 
> Laurent Pinchart
>
Stefan Klug Jan. 14, 2026, 9:59 a.m. UTC | #2
Quoting Laurent Pinchart (2026-01-13 01:07:40)
> The YamlParser::parse() function constructs a std::unique_ptr<> instance
> with a manual call to operator new. Replace it with std::make_unique<>.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>

Regards,
Stefan

> ---
>  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 a5e424615c26..72580e901ddd 100644
> --- a/src/libcamera/yaml_parser.cpp
> +++ b/src/libcamera/yaml_parser.cpp
> @@ -769,7 +769,7 @@ std::unique_ptr<YamlObject> YamlParser::parse(File &file)
>         if (context.init(file))
>                 return nullptr;
>  
> -       std::unique_ptr<YamlObject> root(new YamlObject());
> +       std::unique_ptr<YamlObject> root = std::make_unique<YamlObject>();
>  
>         if (context.parseContent(*root)) {
>                 LOG(YamlParser, Error)
> -- 
> Regards,
> 
> Laurent Pinchart
>

Patch
diff mbox series

diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp
index a5e424615c26..72580e901ddd 100644
--- a/src/libcamera/yaml_parser.cpp
+++ b/src/libcamera/yaml_parser.cpp
@@ -769,7 +769,7 @@  std::unique_ptr<YamlObject> YamlParser::parse(File &file)
 	if (context.init(file))
 		return nullptr;
 
-	std::unique_ptr<YamlObject> root(new YamlObject());
+	std::unique_ptr<YamlObject> root = std::make_unique<YamlObject>();
 
 	if (context.parseContent(*root)) {
 		LOG(YamlParser, Error)