1 From f7d8d7eaf2b4160354887ac740a1efed9b6fc23b Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolan.mcnamara@collabora.com>
3 Date: Sun, 14 Jan 2024 21:03:12 +0000
4 Subject: [PATCH] cid#1546160 COPY_INSTEAD_OF_MOVE
8 cid#1545547 COPY_INSTEAD_OF_MOVE
9 cid#1545642 COPY_INSTEAD_OF_MOVE
10 cid#1557206 COPY_INSTEAD_OF_MOVE
12 include/mdds/flat_segment_tree.hpp | 2 +-
13 include/mdds/flat_segment_tree_def.inl | 6 +++---
14 2 files changed, 4 insertions(+), 4 deletions(-)
16 diff --git a/include/mdds/flat_segment_tree.hpp b/include/mdds/flat_segment_tree.hpp
17 index bf8e0956..317eb279 100644
18 --- a/include/mdds/flat_segment_tree.hpp
19 +++ b/include/mdds/flat_segment_tree.hpp
20 @@ -767,7 +767,7 @@ private:
22 node_ptr next_node = cur_node->next;
23 disconnect_all_nodes(cur_node.get());
24 - cur_node = next_node;
25 + cur_node = std::move(next_node);
27 last_node->next = end_node;
28 end_node->prev = last_node;
29 diff --git a/include/mdds/flat_segment_tree_def.inl b/include/mdds/flat_segment_tree_def.inl
30 index 76350656..d07cae82 100644
31 --- a/include/mdds/flat_segment_tree_def.inl
32 +++ b/include/mdds/flat_segment_tree_def.inl
34 // Move on to the next destination node, and have the next node point
35 // back to the previous node.
36 node_ptr old_node = dest_node;
37 - dest_node->next->prev = old_node;
38 + dest_node->next->prev = std::move(old_node);
39 dest_node = dest_node->next;
41 if (src_node == r.m_right_leaf.get())
44 p = get_insertion_pos_leaf(start_key, p);
45 node_ptr start_pos(const_cast<node*>(p));
46 - return insert_to_pos(start_pos, start_key, end_key, val);
47 + return insert_to_pos(std::move(start_pos), start_key, end_key, val);
50 template<typename Key, typename Value>
52 last_seg_value = node_pos->value_leaf.value;
53 node_ptr next = node_pos->next;
54 disconnect_all_nodes(node_pos.get());
56 + node_pos = std::move(next);
59 start_pos->value_leaf.value = last_seg_value;