mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 17:18:56 +00:00
lib/if.c part from [quagga-dev 552] and lib/inklist.c part from [quagga-dev
555]. Okayed by Paul.
This commit is contained in:
parent
d9fd04c24b
commit
e90fbabdc6
@ -1,3 +1,10 @@
|
|||||||
|
2003-12-21 Hasso Tepper <hasso@estpak.ee>
|
||||||
|
|
||||||
|
* lib/linklist.c: Revert patch [quagga-dev 227]. listnode_add_sort()
|
||||||
|
function should not drop nodes in any case. But fix behavior where
|
||||||
|
nodes were added to the end of list when cmp returned 0.
|
||||||
|
* lib/if.c: Check for duplicates before calling listnode_add_sort().
|
||||||
|
|
||||||
2003-12-08 Greg Troxel <gdt@fnord.ir.bbn.com>
|
2003-12-08 Greg Troxel <gdt@fnord.ir.bbn.com>
|
||||||
|
|
||||||
* {lib,ospfd,ospfapi}/Makefile.am: Use pkginclude_HEADERS rather
|
* {lib,ospfd,ospfapi}/Makefile.am: Use pkginclude_HEADERS rather
|
||||||
|
3
lib/if.c
3
lib/if.c
@ -120,7 +120,8 @@ if_create (char *name, int namelen)
|
|||||||
assert (namelen <= (INTERFACE_NAMSIZ + 1));
|
assert (namelen <= (INTERFACE_NAMSIZ + 1));
|
||||||
strncpy (ifp->name, name, namelen);
|
strncpy (ifp->name, name, namelen);
|
||||||
ifp->name[INTERFACE_NAMSIZ] = '\0';
|
ifp->name[INTERFACE_NAMSIZ] = '\0';
|
||||||
listnode_add_sort (iflist, ifp);
|
if (if_lookup_by_name(ifp->name) == NULL)
|
||||||
|
listnode_add_sort (iflist, ifp);
|
||||||
ifp->connected = list_new ();
|
ifp->connected = list_new ();
|
||||||
ifp->connected->del = (void (*) (void *)) connected_free;
|
ifp->connected->del = (void (*) (void *)) connected_free;
|
||||||
|
|
||||||
|
@ -87,17 +87,15 @@ listnode_add_sort (struct list *list, void *val)
|
|||||||
struct listnode *n;
|
struct listnode *n;
|
||||||
struct listnode *new;
|
struct listnode *new;
|
||||||
|
|
||||||
|
new = listnode_new ();
|
||||||
|
new->data = val;
|
||||||
|
|
||||||
if (list->cmp)
|
if (list->cmp)
|
||||||
{
|
{
|
||||||
for (n = list->head; n; n = n->next)
|
for (n = list->head; n; n = n->next)
|
||||||
{
|
{
|
||||||
if ((*list->cmp) (val, n->data) == 0)
|
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->next = n;
|
||||||
new->prev = n->prev;
|
new->prev = n->prev;
|
||||||
|
|
||||||
@ -112,8 +110,6 @@ listnode_add_sort (struct list *list, void *val)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
new = listnode_new ();
|
|
||||||
new->data = val;
|
|
||||||
new->prev = list->tail;
|
new->prev = list->tail;
|
||||||
|
|
||||||
if (list->tail)
|
if (list->tail)
|
||||||
|
Loading…
Reference in New Issue
Block a user