Function report |
Source Code:lib\assoc_array.c |
Create Date:2022-07-28 06:54:31 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:assoc_array_delete - Script deletion of an object from an associative array*@array: The array to search.*@ops: The operations to use.*@index_key: The key to the object.* Precalculate and preallocate a script for the deletion of an object from an
Proto:struct assoc_array_edit *assoc_array_delete(struct assoc_array *array, const struct assoc_array_ops *ops, const void *index_key)
Type:struct assoc_array_edit
Parameter:
Type | Parameter | Name |
---|---|---|
struct assoc_array * | array | |
const struct assoc_array_ops * | ops | |
const void * | index_key |
1093 | edit = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc). |
1098 | adjust_count_by = -1 |
1105 | pr_devel("terminal_node\n") |
1108 | When slot < Number of slots per node cycle |
1110 | If ptr && assoc_array_ptr_is_leaf(ptr) && compare_object(assoc_array_ptr_to_leaf(ptr), index_key) Then Go to found_leaf |
1117 | Case Navigate through the internal tree looking for the closest node to the key. == assoc_array_walk_tree_empty |
1118 | Case Navigate through the internal tree looking for the closest node to the key. == assoc_array_walk_found_wrong_shortcut |
1119 | Default |
1125 | found_leaf : |
1126 | BUG_ON(nr_leaves_on_tree <= 0) |
1133 | to = NULL |
1134 | adjust_count_on = node |
1139 | If nr_leaves_on_tree == 1 Then |
1158 | If nr_leaves_on_branch <= Number of slots per node + 1 Then |
1166 | has_meta = false |
1167 | When i < Number of slots per node cycle |
1175 | pr_devel("leaves: %ld [m=%d]\n", nr_leaves_on_branch - 1, has_meta) |
1182 | collapse_up : |
1183 | pr_devel("collapse subtree: %ld\n", nr_leaves_on_branch) |
1185 | ptr = back_pointer |
1186 | If Not ptr Then Go to do_collapse |
1188 | If assoc_array_ptr_is_shortcut(ptr) Then |
1189 | s = assoc_array_ptr_to_shortcut(ptr) |
1190 | ptr = back_pointer |
1191 | If Not ptr Then Go to do_collapse |
1195 | grandparent = assoc_array_ptr_to_node(ptr) |
1196 | If nr_leaves_on_branch <= Number of slots per node + 1 Then |
1197 | parent = grandparent |
1198 | Go to collapse_up |
1201 | do_collapse : |
1210 | new_n0 = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc). |
1213 | new_meta[0] = assoc_array_node_to_ptr(new_n0) |
1215 | back_pointer = back_pointer |
1216 | parent_slot = parent_slot |
1218 | adjust_count_on = new_n0 |
1222 | slot = 0 |
1227 | pr_devel("collapsed %d,%lu\n", slot, nr_leaves_on_branch) |
1228 | BUG_ON(slot != nr_leaves_on_branch - 1) |
1230 | If Not back_pointer Then |
1232 | Else if assoc_array_ptr_is_leaf(back_pointer) Then |
1233 | BUG() |
1234 | Else if assoc_array_ptr_is_node(back_pointer) Then |
1235 | p = assoc_array_ptr_to_node(back_pointer) |
1237 | ptr = slots[parent_slot] |
1238 | Else if assoc_array_ptr_is_shortcut(back_pointer) Then |
1239 | s = assoc_array_ptr_to_shortcut(back_pointer) |
1243 | to = assoc_array_node_to_ptr(new_n0) |
1248 | Return edit |
1250 | enomem : |
1252 | pr_devel("enomem\n") |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |