2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (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.
diff --git a/ripd/rip_peer.c b/ripd/rip_peer.c
index 20c2da7..51df568 100644
--- a/ripd/rip_peer.c
+++ b/ripd/rip_peer.c
@@ -53,9 +53,9 @@
rip_peer_lookup (struct in_addr *addr)
{
struct rip_peer *peer;
- struct listnode *nn;
+ struct listnode *node, *nnode;
- LIST_LOOP (peer_list, peer, nn)
+ for (ALL_LIST_ELEMENTS (peer_list, node, nnode, peer))
{
if (IPV4_ADDR_SAME (&peer->addr, addr))
return peer;
@@ -67,9 +67,9 @@
rip_peer_lookup_next (struct in_addr *addr)
{
struct rip_peer *peer;
- struct listnode *nn;
+ struct listnode *node, *nnode;
- LIST_LOOP (peer_list, peer, nn)
+ for (ALL_LIST_ELEMENTS (peer_list, node, nnode, peer))
{
if (htonl (peer->addr.s_addr) > htonl (addr->s_addr))
return peer;
@@ -183,11 +183,11 @@
rip_peer_display (struct vty *vty)
{
struct rip_peer *peer;
- struct listnode *nn;
+ struct listnode *node, *nnode;
#define RIP_UPTIME_LEN 25
char timebuf[RIP_UPTIME_LEN];
- LIST_LOOP (peer_list, peer, nn)
+ for (ALL_LIST_ELEMENTS (peer_list, node, nnode, peer))
{
vty_out (vty, " %-16s %9d %9d %9d %s%s", inet_ntoa (peer->addr),
peer->recv_badpackets, peer->recv_badroutes,