From 3fdb2dd9dd8b4ab3517896092dd1b677d191adf9 Mon Sep 17 00:00:00 2001 From: hasso Date: Wed, 28 Sep 2005 18:45:54 +0000 Subject: * *.c: Massive cleanup of lists loops. Stop abusing ALL_LIST_ELEMENTS. Replace XMALLOC + memset with XCALLOC. Fix some indentation issues. The only really significant change is simplified isis_delete_adj function in isis_adjacency.c. --- isisd/isis_adjacency.c | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) (limited to 'isisd/isis_adjacency.c') diff --git a/isisd/isis_adjacency.c b/isisd/isis_adjacency.c index 3d847732..a898f24b 100644 --- a/isisd/isis_adjacency.c +++ b/isisd/isis_adjacency.c @@ -109,7 +109,6 @@ isis_adj_lookup (u_char * sysid, struct list *adjdb) return NULL; } - struct isis_adjacency * isis_adj_lookup_snpa (u_char * ssnpa, struct list *adjdb) { @@ -123,23 +122,14 @@ isis_adj_lookup_snpa (u_char * ssnpa, struct list *adjdb) return NULL; } -/* - * When we recieve a NULL list, we will know its p2p - */ void isis_delete_adj (struct isis_adjacency *adj, struct list *adjdb) { - struct isis_adjacency *adj2 = NULL; - struct listnode *node; - + if (!adj) + return; + /* When we recieve a NULL list, we will know its p2p. */ if (adjdb) - { - for (ALL_LIST_ELEMENTS_RO (adjdb, node, adj2)) - if (adj2 == adj) - break; - - listnode_delete (adjdb, adj); - } + listnode_delete (adjdb, adj); if (adj->ipv4_addrs) list_delete (adj->ipv4_addrs); @@ -147,15 +137,8 @@ isis_delete_adj (struct isis_adjacency *adj, struct list *adjdb) if (adj->ipv6_addrs) list_delete (adj->ipv6_addrs); #endif - if (adj) - { - XFREE (MTYPE_ISIS_ADJACENCY, adj); - } - else - { - zlog_warn ("tried to delete a non-existent adjacency"); - } - + + XFREE (MTYPE_ISIS_ADJACENCY, adj); return; } -- cgit v1.2.1