From: Ted Lemon Date: Wed, 22 May 1996 07:28:42 +0000 (+0000) Subject: Add function to dump hash tables X-Git-Tag: BETA-2~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2e2f2500bcd8cf168ca83b991a442a7cd6c68f0;p=thirdparty%2Fdhcp.git Add function to dump hash tables --- diff --git a/common/print.c b/common/print.c index 2a212a6ed..56463905b 100644 --- a/common/print.c +++ b/common/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); + } + } +} + diff --git a/print.c b/print.c index 2a212a6ed..56463905b 100644 --- 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); + } + } +} +