]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Add function to dump hash tables
authorTed Lemon <source@isc.org>
Wed, 22 May 1996 07:28:42 +0000 (07:28 +0000)
committerTed Lemon <source@isc.org>
Wed, 22 May 1996 07:28:42 +0000 (07:28 +0000)
common/print.c
print.c

index 2a212a6ed743ffb38e121871534d86743c451c76..56463905b839b57c285791cf0c3c27be095a9693 100644 (file)
@@ -160,3 +160,25 @@ void dump_raw (buf, len)
        note (lbuf);
 }
 
+void hash_dump (table)
+       struct hash_table *table;
+{
+       int i;
+       struct hash_bucket *bp;
+
+       if (!table)
+               return;
+
+       for (i = 0; i < table -> hash_count; i++) {
+               if (!table -> buckets [i])
+                       continue;
+               note ("hash bucket %d:", i);
+               for (bp = table -> buckets [i]; bp; bp = bp -> next) {
+                       if (bp -> len)
+                               dump_raw (bp -> name, bp -> len);
+                       else
+                               note (bp -> name);
+               }
+       }
+}
+
diff --git a/print.c b/print.c
index 2a212a6ed743ffb38e121871534d86743c451c76..56463905b839b57c285791cf0c3c27be095a9693 100644 (file)
--- a/print.c
+++ b/print.c
@@ -160,3 +160,25 @@ void dump_raw (buf, len)
        note (lbuf);
 }
 
+void hash_dump (table)
+       struct hash_table *table;
+{
+       int i;
+       struct hash_bucket *bp;
+
+       if (!table)
+               return;
+
+       for (i = 0; i < table -> hash_count; i++) {
+               if (!table -> buckets [i])
+                       continue;
+               note ("hash bucket %d:", i);
+               for (bp = table -> buckets [i]; bp; bp = bp -> next) {
+                       if (bp -> len)
+                               dump_raw (bp -> name, bp -> len);
+                       else
+                               note (bp -> name);
+               }
+       }
+}
+