summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorgdt <gdt>2004-08-31 17:28:41 +0000
committergdt <gdt>2004-08-31 17:28:41 +0000
commit630e48072a4a4685a7c04a7b73ae9170d2f0844a (patch)
tree1a343e551a0ce24d8c8c93aa62860742749355ee /lib
parent94755ea13e9466fc4590994b551dc23a44571622 (diff)
Assorted changes from work at BBN. Most are minor, and several are in
support of more significant changes not in this commit. The last item in the ChangeLog below may be needed for p2mp to work correctly. 2004-08-31 David Wiggins <dwiggins@bbn.com> * hash.c (hash_iterate): Save next pointer before calling procedure, so that iteration works even if the called procedure deletes the hash backet. * linklist.h (listtail): new macro, not yet used. 2004-08-31 David Wiggins <dwiggins@bbn.com> * ospf_spf.c (ospf_spf_calculate): Many more comments and debug print statements. New function ospf_vertex_dump used in debugging. 2004-08-31 David Wiggins <dwiggins@bbn.com> * ospf_spf.h (struct vertex): Comments for flags and structure members. 2004-08-31 David Wiggins <dwiggins@bbn.com> * ospf_route.c: When finding an alternate route, log cost as well. 2004-08-31 David Wiggins <dwiggins@bbn.com> * ospf_interface.c (ospf_lookup_if_params): Initialize af in struct prefix allocated on stack. 2004-08-31 David Wiggins <dwiggins@bbn.com> * ospf_packet.c (ospf_ls_ack_send_delayed): In p2mp mode, send acks to AllSPFRouters, rather than All-DR.
Diffstat (limited to 'lib')
-rw-r--r--lib/ChangeLog8
-rw-r--r--lib/hash.c11
-rw-r--r--lib/linklist.h1
3 files changed, 18 insertions, 2 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog
index ea965eae..c72fa28a 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,11 @@
+2004-08-31 David Wiggins <dwiggins@bbn.com>
+
+ * hash.c (hash_iterate): Save next pointer before calling
+ procedure, so that iteration works even if the called procedure
+ deletes the hash backet.
+
+ * linklist.h (listtail): new macro, not yet used.
+
2004-08-27 Hasso Tepper <hasso at quagga.net>
* command.c: Install "terminal length" commands only if vty is used.
diff --git a/lib/hash.c b/lib/hash.c
index 40975079..e89171b8 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -142,10 +142,17 @@ hash_iterate (struct hash *hash,
{
int i;
struct hash_backet *hb;
+ struct hash_backet *hbnext;
for (i = 0; i < hash->size; i++)
- for (hb = hash->index[i]; hb; hb = hb->next)
- (*func) (hb, arg);
+ for (hb = hash->index[i]; hb; hb = hbnext)
+ {
+ /* get pointer to next hash backet here, in case (*func)
+ * decides to delete hb by calling hash_release
+ */
+ hbnext = hb->next;
+ (*func) (hb, arg);
+ }
}
/* Clean up hash. */
diff --git a/lib/linklist.h b/lib/linklist.h
index 331135fe..303b0bce 100644
--- a/lib/linklist.h
+++ b/lib/linklist.h
@@ -48,6 +48,7 @@ struct list
#define nextnode(X) ((X) = (X)->next)
#define listhead(X) ((X)->head)
+#define listtail(X) ((X)->tail)
#define listcount(X) ((X)->count)
#define list_isempty(X) ((X)->head == NULL && (X)->tail == NULL)
#define getdata(X) ((X)->data)