c-algorithms
c-algorithms copied to clipboard
Prototype for AVLTreeCompareFunc is incorrect, causing confusion
At line 119 of https://github.com/fragglet/c-algorithms/blob/master/src/avl-tree.h, there is a function pointer for AVLTreeCompareFunc declared.
The declaration is:
typedef int (*AVLTreeCompareFunc)(AVLTreeValue value1, AVLTreeValue value2);
But the documentation (and code) shows that this function is for comparing the keys of two nodes in the tree, so the declaration should actually be:
typedef int (*AVLTreeCompareFunc)(AVLTreeKey key1, AVLTreeKey key2);
As both AVLTreeKey and AVLTreeValue are themselves typedefed as **void ***, it doesn’t actually make any difference to the function operation, but it makes the prototype confusing.