if (mas_is_err(mas))
return 0;
- /* Set up right side. */
+ /*
+ * Set up right side. Need to get to the next offset after the spanning
+ * store to ensure it's not NULL and to combine both the next node and
+ * the node with the start together.
+ */
r_mas = *mas;
/* Avoid overflow, walk to next slot in the tree. */
if (r_mas.last + 1)
r_mas.index = r_mas.last;
r_wr_mas.mas = &r_mas;
- mas_wr_walk(&r_wr_mas);
+ mas_wr_walk_index(&r_wr_mas);
r_mas.last = r_mas.index = mas->last;
/* Set up left side. */
mas->offset = l_mas.offset;
mas->index = l_mas.index;
mas->last = l_mas.last = r_mas.last;
- } else
- l_mas.last = mas->last;
+ }
/* Copy l_mas and store the value in b_node. */
b_node.b_end = mas_store_b_node(&l_wr_mas, &b_node, l_wr_mas.node_end);