Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/src/linux_radix.c
Show First 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | if (next == NULL) { | ||||
if ((index & mask) == 0) | if ((index & mask) == 0) | ||||
goto restart; | goto restart; | ||||
} else { | } else { | ||||
node = next; | node = next; | ||||
height--; | height--; | ||||
} | } | ||||
} while (height != -1); | } while (height != -1); | ||||
iter->index = index; | iter->index = index; | ||||
iter->next_index = index++; | |||||
hselasky: this looks like a bug? ++index ?? See comments below. | |||||
Done Inline ActionsYes. I simplified the code as you suggested. johalun0_gmail.com: Yes. I simplified the code as you suggested.
| |||||
return (true); | return (true); | ||||
} | } | ||||
void * | void * | ||||
radix_tree_delete(struct radix_tree_root *root, unsigned long index) | radix_tree_delete(struct radix_tree_root *root, unsigned long index) | ||||
{ | { | ||||
struct radix_tree_node *stack[RADIX_TREE_MAX_HEIGHT]; | struct radix_tree_node *stack[RADIX_TREE_MAX_HEIGHT]; | ||||
struct radix_tree_node *node; | struct radix_tree_node *node; | ||||
Show All 32 Lines | for (;;) { | ||||
break; | break; | ||||
} | } | ||||
height++; | height++; | ||||
node = stack[height]; | node = stack[height]; | ||||
idx = radix_pos(index, height); | idx = radix_pos(index, height); | ||||
} | } | ||||
out: | out: | ||||
return (item); | return (item); | ||||
} | |||||
void | |||||
radix_tree_iter_delete(struct radix_tree_root *root, | |||||
struct radix_tree_iter *iter, void **slot) | |||||
{ | |||||
if (radix_tree_delete(root, iter->index)) { | |||||
Done Inline ActionsThis increment is done by the caller and should be removed! hselasky: This increment is done by the caller and should be removed! | |||||
iter->index = iter->next_index; | |||||
Done Inline Actionsiter->index++ ?? hselasky: iter->index++ ?? | |||||
} | |||||
} | } | ||||
int | int | ||||
radix_tree_insert(struct radix_tree_root *root, unsigned long index, void *item) | radix_tree_insert(struct radix_tree_root *root, unsigned long index, void *item) | ||||
{ | { | ||||
struct radix_tree_node *node; | struct radix_tree_node *node; | ||||
struct radix_tree_node *temp[RADIX_TREE_MAX_HEIGHT - 1]; | struct radix_tree_node *temp[RADIX_TREE_MAX_HEIGHT - 1]; | ||||
int height; | int height; | ||||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |
this looks like a bug? ++index ?? See comments below.