From 739c75e490ecd4a5f16d7edd3353d88aad1d2a50 Mon Sep 17 00:00:00 2001 From: Scott Wolchok Date: Wed, 6 Nov 2024 17:20:59 -0800 Subject: [PATCH] Fix missing move and bare new in pytree from_str_internal Just a couple minor fixes. Differential Revision: [D65576543](https://our.internmc.facebook.com/intern/diff/D65576543/) [ghstack-poisoned] --- extension/pytree/pytree.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/extension/pytree/pytree.h b/extension/pytree/pytree.h index 8141a104c04..c4f4303f57f 100644 --- a/extension/pytree/pytree.h +++ b/extension/pytree/pytree.h @@ -138,6 +138,8 @@ struct ContainerHandle { /*implicit*/ ContainerHandle(container_type* c) : handle(c) {} + /*implicit*/ ContainerHandle(std::unique_ptr c) : handle(std::move(c)) {} + void set_leaf(leaf_type* leaf) { pytree_assert(handle->kind == Kind::Leaf); handle->leaf = leaf; @@ -485,10 +487,10 @@ TreeSpec from_str_internal( read_idx++; auto layout = read_node_layout(spec, read_idx); const auto size = layout.size(); - auto c = new TreeSpecContainer(kind, size); + auto c = std::make_unique>(kind, size); if (Kind::Custom == kind) { - c->custom_type = custom_type; + c->custom_type = std::move(custom_type); } size_t child_idx = 0; @@ -515,7 +517,7 @@ TreeSpec from_str_internal( read_idx++; auto layout = read_node_layout(spec, read_idx); const auto size = layout.size(); - auto c = new TreeSpecContainer(Kind::Dict, size); + auto c = std::make_unique>(Kind::Dict, size); size_t child_idx = 0; size_t leaves_offset = 0;