2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-30 05:47:45 +00:00

Add function to dump hash tables

This commit is contained in:
Ted Lemon 1996-05-22 07:28:42 +00:00
parent b400da0a56
commit f2e2f2500b
2 changed files with 44 additions and 0 deletions

View 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);
}
}
}

22
print.c
View 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);
}
}
}