Rev 1148 | Rev 1164 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1148 | Rev 1150 | ||
---|---|---|---|
Line 338... | Line 338... | ||
338 | * The key was not found in the *leaf_node and is smaller than any of its keys. |
338 | * The key was not found in the *leaf_node and is smaller than any of its keys. |
339 | */ |
339 | */ |
340 | return NULL; |
340 | return NULL; |
341 | } |
341 | } |
342 | 342 | ||
343 | /** Return pointer to B-tree node's left sibling. |
343 | /** Return pointer to B-tree leaf node's left neighbour. |
344 | * |
344 | * |
345 | * @param t B-tree. |
345 | * @param t B-tree. |
346 | * @param node Node whose left sibling will be returned. |
346 | * @param node Node whose left neighbour will be returned. |
347 | * |
347 | * |
348 | * @return Left sibling of the node or NULL if the node does not have the left sibling. |
348 | * @return Left neighbour of the node or NULL if the node does not have the left neighbour. |
349 | */ |
349 | */ |
350 | btree_node_t *btree_node_left_sibling(btree_t *t, btree_node_t *node) |
350 | btree_node_t *btree_leaf_node_left_neighbour(btree_t *t, btree_node_t *node) |
351 | { |
351 | { |
352 | ASSERT(LEAF_NODE(node)); |
352 | ASSERT(LEAF_NODE(node)); |
353 | if (node->leaf_link.prev != &t->leaf_head) |
353 | if (node->leaf_link.prev != &t->leaf_head) |
354 | return list_get_instance(node->leaf_link.prev, btree_node_t, leaf_link); |
354 | return list_get_instance(node->leaf_link.prev, btree_node_t, leaf_link); |
355 | else |
355 | else |
356 | return NULL; |
356 | return NULL; |
357 | } |
357 | } |
358 | 358 | ||
359 | /** Return pointer to B-tree node's right sibling. |
359 | /** Return pointer to B-tree leaf node's right neighbour. |
360 | * |
360 | * |
361 | * @param t B-tree. |
361 | * @param t B-tree. |
362 | * @param node Node whose right sibling will be returned. |
362 | * @param node Node whose right neighbour will be returned. |
363 | * |
363 | * |
364 | * @return Right sibling of the node or NULL if the node does not have the right sibling. |
364 | * @return Right neighbour of the node or NULL if the node does not have the right neighbour. |
365 | */ |
365 | */ |
366 | btree_node_t *btree_node_right_sibling(btree_t *t, btree_node_t *node) |
366 | btree_node_t *btree_leaf_node_right_neighbour(btree_t *t, btree_node_t *node) |
367 | { |
367 | { |
368 | ASSERT(LEAF_NODE(node)); |
368 | ASSERT(LEAF_NODE(node)); |
369 | if (node->leaf_link.next != &t->leaf_head) |
369 | if (node->leaf_link.next != &t->leaf_head) |
370 | return list_get_instance(node->leaf_link.next, btree_node_t, leaf_link); |
370 | return list_get_instance(node->leaf_link.next, btree_node_t, leaf_link); |
371 | else |
371 | else |