c-algorithms icon indicating copy to clipboard operation
c-algorithms copied to clipboard

Prototype for AVLTreeCompareFunc is incorrect, causing confusion

Open curlybeast opened this issue 9 years ago • 0 comments

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.

curlybeast avatar Jun 18 '15 11:06 curlybeast