From 89f43c0d578a22f40012eb3f04770c9f128ecdeb Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Tue, 8 Sep 2020 13:00:59 -0400 Subject: [PATCH] maple_tree: use mte_slots for dup Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index e6b7e2ecb2ad..52c0b93a8b6c 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4377,8 +4377,10 @@ static inline void mas_dup_children(struct ma_state *mas, int *node_cnt) { struct maple_node *child; struct maple_enode *oldchild, *echild; - unsigned char slot, end = mt_slot_count(mas->node); + unsigned char offset, end = mt_slot_count(mas->node); int allocated = mas_alloc_cnt(mas); + void **slots = ma_get_slots(mte_to_node(mas->node), + mte_node_type(mas->node)); if (allocated < end) { mas->span_enode = mas->node; @@ -4390,14 +4392,14 @@ static inline void mas_dup_children(struct ma_state *mas, int *node_cnt) } - for(slot = 0; slot < end; slot++) { - oldchild = mas_get_slot(mas, slot); + for(offset = 0; offset < end; offset++) { + oldchild = slots[offset]; if (!oldchild) return; child = mas_next_alloc(mas); echild = mt_mk_node(child, mte_node_type(oldchild)); - mte_set_slot(mas->node, slot, echild); + slots[offset] = echild; memcpy(child, mte_to_node(oldchild), sizeof(struct maple_node)); } } -- 2.50.1