* lib/linklist.c: (if_cmp_func) Fix handling of case where
list->cmp returns 0.
struct listnode *n;
struct listnode *new;
- new = listnode_new ();
- new->data = val;
if (list->cmp)
{
for (n = list->head; n; n = n->next)
{
+ if ((*list->cmp) (val, n->data) == 0)
+ return;
if ((*list->cmp) (val, n->data) < 0)
{
+ new = listnode_new ();
+ new->data = val;
new->next = n;
new->prev = n->prev;
}
}
+ new = listnode_new ();
+ new->data = val;
new->prev = list->tail;
if (list->tail)