mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 16:20:08 +00:00
2003-09-24 sowmini.varadhan@sun.com
* lib/linklist.c: (if_cmp_func) Fix handling of case where list->cmp returns 0.
This commit is contained in:
parent
90578521e5
commit
729606fea2
@ -87,15 +87,17 @@ listnode_add_sort (struct list *list, void *val)
|
||||
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;
|
||||
|
||||
@ -110,6 +112,8 @@ listnode_add_sort (struct list *list, void *val)
|
||||
}
|
||||
}
|
||||
|
||||
new = listnode_new ();
|
||||
new->data = val;
|
||||
new->prev = list->tail;
|
||||
|
||||
if (list->tail)
|
||||
|
Loading…
Reference in New Issue
Block a user