Skip to content

Prototype for AVLTreeCompareFunc is incorrect, causing confusion #3

@curlybeast

Description

@curlybeast

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions