I'd like to be able to tell when avl_insert fails because of a duplicate key as
opposed to when it fails due to out of memory or other condition.
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
if (cmp == 0)
{
free_node (new);
- return (-1);
+ return (1);
}
else if (cmp < 0)
{
* `value' Value to be stored.
*
* RETURN VALUE
- * Zero upon success and non-zero upon failure and if the key is already
- * stored in the tree.
+ * Zero upon success, non-zero otherwise. It's less than zero if an error
+ * occurred or greater than zero if the key is already stored in the tree.
*/
int avl_insert (avl_tree_t *t, void *key, void *value);