Function report |
Source Code:lib\assoc_array.c |
Create Date:2022-07-28 06:54:13 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:Navigate through the internal tree looking for the closest node to the key.
Proto:static enum assoc_array_walk_status assoc_array_walk(const struct assoc_array *array, const struct assoc_array_ops *ops, const void *index_key, struct assoc_array_walk_result *result)
Type:enum assoc_array_walk_status
Parameter:
| Type | Parameter | Name |
|---|---|---|
| const struct assoc_array * | array | |
| const struct assoc_array_ops * | ops | |
| const void * | index_key | |
| struct assoc_array_walk_result * | result |
| 186 | If Not cursor Then Return assoc_array_walk_tree_empty |
| 189 | level = 0 |
| 198 | jumped : |
| 199 | segments = get_key_chunk(index_key, level) |
| 202 | If assoc_array_ptr_is_shortcut(cursor) Then Go to follow_shortcut |
| 205 | consider_node : |
| 206 | node = assoc_array_ptr_to_node(cursor) |
| 207 | slot = segments >> (level & ASSOC_ARRAY_KEY_CHUNK_MASK) |
| 208 | slot &= ASSOC_ARRAY_FAN_MASK |
| 214 | If Not assoc_array_ptr_is_meta(ptr) Then |
| 222 | Return assoc_array_walk_found_terminal_node |
| 225 | If assoc_array_ptr_is_node(ptr) Then |
| 230 | level += ASSOC_ARRAY_LEVEL_STEP |
| 231 | If (level & ASSOC_ARRAY_KEY_CHUNK_MASK) != 0 Then Go to consider_node |
| 233 | Go to jumped |
| 241 | follow_shortcut : |
| 243 | pr_devel("shortcut to %d\n", skip_to_level) |
| 244 | sc_level = level + ASSOC_ARRAY_LEVEL_STEP |
| 245 | BUG_ON(sc_level > skip_to_level) |
| 247 | Do |
| 252 | If (sc_level & ASSOC_ARRAY_KEY_CHUNK_MASK) == 0 Then segments = get_key_chunk(index_key, sc_level) |
| 256 | dissimilarity = segments ^ sc_segments |
| 261 | dissimilarity &= ~(ULONG_MAX << shift) |
| 262 | next_sc_level = skip_to_level |
| 263 | Else |
| 268 | If dissimilarity != 0 Then |
| 273 | sc_segments = sc_segments |
| 274 | dissimilarity = dissimilarity |
| 275 | Return assoc_array_walk_found_wrong_shortcut |
| 278 | sc_level = next_sc_level |
| 279 | When sc_level < skip_to_level cycle |
| 283 | If ((level ^ sc_level) & ~ASSOC_ARRAY_KEY_CHUNK_MASK) != 0 Then |
| 286 | Else |
| 288 | Go to consider_node |
| Name | Describe |
|---|---|
| assoc_array_find | assoc_array_find - Find an object by index key*@array: The associative array to search |
| assoc_array_insert | assoc_array_insert - Script insertion of an object into an associative array*@array: The array to insert into |
| assoc_array_delete | 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 |
| 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 |