| 596 | } |
| 597 | |
| 598 | int iterator_next( map_iterator_t * it ) |
| 599 | { |
| 600 | |
| 601 | struct avl_node *q, *p; /* Current node and its child. */ |
| 602 | |
| 603 | if( it == NULL || it->map ==NULL || it->node == NULL) |
| 604 | return -1; |
| 605 | |
| 606 | if( it->node->avl_link[1] ) |
| 607 | { |
| 608 | it->node = it->node->avl_link[1]; |
| 609 | while( it->node->avl_link[0] ) |
| 610 | it->node = it->node->avl_link[0]; |
| 611 | |
| 612 | } |
| 613 | else |
| 614 | { |
| 615 | |
| 616 | for (p = it->node, q = p->avl_parent ; ; p = q, q = q->avl_parent) |
| 617 | if (q == NULL || p == q->avl_link[0]) |
| 618 | { |
| 619 | it->node = q; |
| 620 | return 0; |
| 621 | } |
| 622 | } |
| 623 | |
| 624 | return 0; |
| 625 | } |
| 626 | |
| 627 | |
| 628 | int iterator_prev( map_iterator_t * it ) |
no outgoing calls
no test coverage detected