}
void *mas_store(struct ma_state *mas, void *entry)
{
- if (mas->index > mas->last) {
- mas_set_err(mas, -EINVAL);
- return NULL;
- }
+ if (mas->index <= mas->last)
+ return _mas_store(mas, entry, true);
+
+ mas_set_err(mas, -EINVAL);
+ return NULL;
- return _mas_store(mas, entry, true);
}
static inline int mas_dead_node(struct ma_state *mas, unsigned long index);
{
unsigned char slot;
- // walk up.
while (1) {
slot = mte_parent_slot(mas->node);
if (mte_is_root(mas->node))
goto no_entry;
}
-
walk_down:
do {
void *entry = NULL;
goto no_entry;
if (mte_is_leaf(mas->node)) {
- goto done;
+ goto found_next;
}
slot = 0;
} while (1);
-done:
+found_next:
mas_set_slot(mas, slot);
return;