diff --git a/src/avl-tree.c b/src/avl-tree.c index f4ab9cc..4b826ba 100644 --- a/src/avl-tree.c +++ b/src/avl-tree.c @@ -532,7 +532,7 @@ unsigned int avl_tree_num_entries(AVLTree *tree) } static void avl_tree_to_array_add_subtree(AVLTreeNode *subtree, - AVLTreeValue *array, int *index) + AVLTreeKey *array, int *index) { if (subtree == NULL) { return; @@ -551,13 +551,13 @@ static void avl_tree_to_array_add_subtree(AVLTreeNode *subtree, array, index); } -AVLTreeValue *avl_tree_to_array(AVLTree *tree) +AVLTreeKey *avl_tree_to_array(AVLTree *tree) { - AVLTreeValue *array; + AVLTreeKey *array; int index; /* Allocate the array */ - array = malloc(sizeof(AVLTreeValue) * tree->num_nodes); + array = malloc(sizeof(AVLTreeKey) * tree->num_nodes); if (array == NULL) { return NULL; diff --git a/src/avl-tree.h b/src/avl-tree.h index c2b2f89..c7f576d 100644 --- a/src/avl-tree.h +++ b/src/avl-tree.h @@ -115,7 +115,7 @@ typedef enum { * be sorted before value1, zero if the two keys * are equal. */ -typedef int (*AVLTreeCompareFunc)(AVLTreeValue value1, AVLTreeValue value2); +typedef int (*AVLTreeCompareFunc)(AVLTreeKey value1, AVLTreeKey value2); /** * Create a new AVL tree. @@ -248,11 +248,11 @@ int avl_tree_subtree_height(AVLTreeNode *node); * * @param tree The tree. * @return A newly allocated C array containing all the keys - * in the tree, in order. The length of the array + * in the tree, in order. The length of the array * is equal to the number of entries in the tree * (see @ref avl_tree_num_entries). */ -AVLTreeValue *avl_tree_to_array(AVLTree *tree); +AVLTreeKey *avl_tree_to_array(AVLTree *tree); /** * Retrieve the number of entries in the tree. diff --git a/src/hash-table.c b/src/hash-table.c index d338c23..e41cae1 100644 --- a/src/hash-table.c +++ b/src/hash-table.c @@ -418,7 +418,7 @@ HashTablePair hash_table_iter_next(HashTableIterator *iterator) { HashTableEntry *current_entry; HashTable *hash_table; - HashTablePair pair = {HASH_TABLE_NULL, HASH_TABLE_NULL}; + HashTablePair pair = {HASH_TABLE_KEY_NULL, HASH_TABLE_NULL}; unsigned int chain; hash_table = iterator->hash_table; diff --git a/src/rb-tree.c b/src/rb-tree.c index c421929..2b5cd1e 100644 --- a/src/rb-tree.c +++ b/src/rb-tree.c @@ -344,7 +344,7 @@ RBTreeNode *rb_tree_insert(RBTree *tree, RBTreeKey key, RBTreeValue value) parent = *rover; /* Choose which path to go down, left or right child */ - if (tree->compare_func(value, (*rover)->value) < 0) { + if (tree->compare_func(key, (*rover)->key) < 0) { side = RB_TREE_NODE_LEFT; } else { side = RB_TREE_NODE_RIGHT; @@ -456,7 +456,7 @@ RBTreeNode *rb_tree_node_parent(RBTreeNode *node) return node->parent; } -RBTreeValue *rb_tree_to_array(RBTree *tree) +RBTreeKey *rb_tree_to_array(RBTree *tree) { /* TODO */ return NULL; diff --git a/src/rb-tree.h b/src/rb-tree.h index 6dc1c91..871edb9 100644 --- a/src/rb-tree.h +++ b/src/rb-tree.h @@ -106,7 +106,7 @@ typedef struct _RBTreeNode RBTreeNode; * be sorted before data1, zero if the two keys * are equal. */ -typedef int (*RBTreeCompareFunc)(RBTreeValue data1, RBTreeValue data2); +typedef int (*RBTreeCompareFunc)(RBTreeKey data1, RBTreeKey data2); /** * Each node in a red-black tree is either red or black. @@ -259,7 +259,7 @@ int rb_tree_subtree_height(RBTreeNode *node); * is equal to the number of entries in the tree * (see @ref rb_tree_num_entries). */ -RBTreeValue *rb_tree_to_array(RBTree *tree); +RBTreeKey *rb_tree_to_array(RBTree *tree); /** * Retrieve the number of entries in the tree.