From 1eb8ef2584833f18fb674e127d59cb5a7f771482 Mon Sep 17 00:00:00 2001 From: paul Date: Thu, 7 Apr 2005 07:30:20 +0000 Subject: 2005-04-07 Paul Jakma * (global): Fix up list loops to match changes in lib/linklist, and some basic auditing of usage. * configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES * HACKING: Add notes about deprecating interfaces and commands. * lib/linklist.h: Add usage comments. Rename getdata macro to listgetdata. Rename nextnode to listnextnode and fix its odd behaviour to be less dangerous. Make listgetdata macro assert node is not null, NULL list entries should be bug condition. ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use with for loop, Suggested by Jim Carlson of Sun. Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the "safety" of previous macro. LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to distinguish from the similarly named functions, and reflect their effect better. Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section with the old defines which were modified above, for backwards compatibility - guarded to prevent Quagga using it.. * lib/linklist.c: fix up for linklist.h changes. * ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single scan of the area list, rather than scanning all areas first for INTER_ROUTER and then again for INTER_NETWORK. According to 16.2, the scan should be area specific anyway, and further ospf6d does not seem to implement 16.3 anyway. --- isisd/isis_dr.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'isisd/isis_dr.c') diff --git a/isisd/isis_dr.c b/isisd/isis_dr.c index 4eadc9c1..75713566 100644 --- a/isisd/isis_dr.c +++ b/isisd/isis_dr.c @@ -130,7 +130,7 @@ int isis_dr_elect (struct isis_circuit *circuit, int level) { struct list *adjdb; - struct listnode *node; + struct listnode *node, *nnode; struct isis_adjacency *adj, *adj_dr = NULL; struct list *list = list_new (); u_char own_prio; @@ -152,9 +152,8 @@ isis_dr_elect (struct isis_circuit *circuit, int level) /* * Loop the adjacencies and find the one with the biggest priority */ - for (node = listhead (list); node; nextnode (node)) + for (ALL_LIST_ELEMENTS (list, node, nnode, adj)) { - adj = getdata (node); /* clear flag for show output */ adj->dis_record[level - 1].dis = ISIS_IS_NOT_DIS; adj->dis_record[level - 1].last_dis_change = time (NULL); @@ -215,11 +214,8 @@ isis_dr_elect (struct isis_circuit *circuit, int level) */ /* rotate the history log */ - for (node = listhead (list); node; nextnode (node)) - { - adj = getdata (node); - isis_check_dr_change (adj, level); - } + for (ALL_LIST_ELEMENTS (list, node, nnode, adj)) + isis_check_dr_change (adj, level); /* commence */ list_delete (list); @@ -238,11 +234,8 @@ isis_dr_elect (struct isis_circuit *circuit, int level) * if yes rotate the history log */ - for (node = listhead (list); node; nextnode (node)) - { - adj = getdata (node); - isis_check_dr_change (adj, level); - } + for (ALL_LIST_ELEMENTS (list, node, nnode, adj)) + isis_check_dr_change (adj, level); /* * We are not DR - if we were -> resign -- cgit v1.2.1