#include "avl.h"
#include "list.h"
-#define list_merge(_head, _list) list_merge(_list, _head)
-#define list_is_last(_head, _list) list_is_last(_list, _head)
-#define list_is_first(_head, _list) list_is_first(_list, _head)
-
/**
* internal type save inline function to calculate the maximum of
* to integers without macro implementation.
/* go left as long as key<node.key */
while (diff < 0) {
- if (list_is_first(&tree->list_head, &node->list)) {
+ if (list_is_first(&node->list, &tree->list_head)) {
return NULL;
}
next = node;
while (diff >= 0) {
node = next;
- if (list_is_last(&tree->list_head, &node->list)) {
+ if (list_is_last(&node->list, &tree->list_head)) {
break;
}
/* go right as long as key>node.key */
while (diff > 0) {
- if (list_is_last(&tree->list_head, &node->list)) {
+ if (list_is_last(&node->list, &tree->list_head)) {
return NULL;
}
next = node;
while (diff <= 0) {
node = next;
- if (list_is_first(&tree->list_head, &node->list)) {
+ if (list_is_first(&node->list, &tree->list_head)) {
break;
}
last = node;
- while (!list_is_last(&tree->list_head, &last->list)) {
+ while (!list_is_last(&last->list, &tree->list_head)) {
next = list_next_element(last, list);
if (next->leader) {
break;
struct avl_node *right;
if (node->leader) {
if (tree->allow_dups
- && !list_is_last(&tree->list_head, &node->list)
+ && !list_is_last(&node->list, &tree->list_head)
&& !(next = list_next_element(node, list))->leader) {
next->leader = true;
next->balance = node->balance;