]> andersk Git - moira.git/commitdiff
added function to step through a hash table
authormar <mar>
Thu, 4 Aug 1988 10:44:34 +0000 (10:44 +0000)
committermar <mar>
Thu, 4 Aug 1988 10:44:34 +0000 (10:44 +0000)
lib/hash.c

index 18675c11a68d86f2283358dc5884242142a75664..c04fd171819c1ed4fcb368947a82a393a866265f 100644 (file)
@@ -118,6 +118,23 @@ void (*callback)();
 }
 
 
+/* Step through the hash table, calling the callback proc with each key.
+ */
+
+hash_step(h, callback)
+struct hash *h;
+void (*callback)();
+{
+    register struct bucket *b, **p;
+
+    for (p = &(h->data[h->size - 1]); p >= h->data; p--) {
+       for (b = *p; b; b = b->next) {
+           (*callback)(b->key, b->data);
+       }
+    }
+}
+
+
 /* Deallocate all of the memory associated with a table */
 
 hash_destroy(h)
This page took 0.083516 seconds and 5 git commands to generate.