]> andersk Git - moira.git/blobdiff - lib/hash.c
corrected behavior and added Author
[moira.git] / lib / hash.c
index 18675c11a68d86f2283358dc5884242142a75664..200fae56116c65ff200299cc9c576cc49affa9f7 100644 (file)
@@ -1,10 +1,16 @@
 /* $Header$
  *
  * Generic hash table routines.  Uses integer keys to store char * values.
+ *
+ *  (c) Copyright 1988 by the Massachusetts Institute of Technology.
+ *  For copying and distribution information, please see the file
+ *  <mit-copyright.h>.
  */
 
+#include <mit-copyright.h>
 #include <ctype.h>
-#include "sms_app.h"
+#include <sms.h>
+
 #define NULL 0
 
 
@@ -118,6 +124,24 @@ void (*callback)();
 }
 
 
+/* Step through the hash table, calling the callback proc with each key.
+ */
+
+hash_step(h, callback, hint)
+struct hash *h;
+void (*callback)();
+char *hint;
+{
+    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, hint);
+       }
+    }
+}
+
+
 /* Deallocate all of the memory associated with a table */
 
 hash_destroy(h)
This page took 0.030474 seconds and 4 git commands to generate.