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/lib/smux.c b/lib/smux.c
index 0c2dba3..28f402d 100644
--- a/lib/smux.c
+++ b/lib/smux.c
@@ -441,12 +441,11 @@
int result;
u_char *statP = NULL;
WriteMethod *write_method = NULL;
- struct listnode *node;
+ struct listnode *node, *nnode;
/* Check */
- for (node = treelist->head; node; node = node->next)
+ for (ALL_LIST_ELEMENTS (treelist, node, nnode, subtree))
{
- subtree = node->data;
subresult = oid_compare_part (reqid, *reqid_len,
subtree->name, subtree->name_len);
@@ -509,12 +508,11 @@
size_t suffix_len;
int result;
WriteMethod *write_method=NULL;
- struct listnode *node;
+ struct listnode *node, *nnode;
/* Check */
- for (node = treelist->head; node; node = node->next)
+ for (ALL_LIST_ELEMENTS (treelist, node, nnode,subtree))
{
- subtree = node->data;
subresult = oid_compare_part (reqid, *reqid_len,
subtree->name, subtree->name_len);
@@ -578,7 +576,7 @@
size_t suffix_len;
int result;
WriteMethod *write_method=NULL;
- struct listnode *node;
+ struct listnode *node, *nnode;
/* Save incoming request. */
@@ -586,9 +584,8 @@
savelen = *reqid_len;
/* Check */
- for (node = treelist->head; node; node = node->next)
+ for (ALL_LIST_ELEMENTS (treelist, node, nnode, subtree))
{
- subtree = node->data;
subresult = oid_compare_part (reqid, *reqid_len,
subtree->name, subtree->name_len);
@@ -1108,17 +1105,15 @@
long priority;
long operation;
struct subtree *subtree;
- struct listnode *node;
+ struct listnode *node, *nnode;
ret = 0;
- for (node = treelist->head; node; node = node->next)
+ for (ALL_LIST_ELEMENTS (treelist, node, nnode, subtree))
{
ptr = buf;
len = BUFSIZ;
- subtree = node->data;
-
/* SMUX RReq Header. */
ptr = asn_build_header (ptr, &len, (u_char) SMUX_RREQ, 0);