diff options
author | iedowse <iedowse@FreeBSD.org> | 2002-06-30 02:07:26 +0000 |
---|---|---|
committer | iedowse <iedowse@FreeBSD.org> | 2002-06-30 02:07:26 +0000 |
commit | b5040e7472f6409b83f8a0f11541cd0bb615ee2c (patch) | |
tree | 8c760c1fdd654f0a5cc77775e3721b595b26c183 /sys/kern | |
parent | ab92b925162653533329d715edaa0cabb70f8803 (diff) | |
download | FreeBSD-src-b5040e7472f6409b83f8a0f11541cd0bb615ee2c.zip FreeBSD-src-b5040e7472f6409b83f8a0f11541cd0bb615ee2c.tar.gz |
Add a hashdestroy() function to undo the actions of hashinit().
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_subr.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sys/kern/kern_subr.c b/sys/kern/kern_subr.c index c63091c..1961839 100644 --- a/sys/kern/kern_subr.c +++ b/sys/kern/kern_subr.c @@ -495,6 +495,21 @@ hashinit(elements, type, hashmask) return (hashtbl); } +void +hashdestroy(vhashtbl, type, hashmask) + void *vhashtbl; + struct malloc_type *type; + u_long hashmask; +{ + LIST_HEAD(generic, generic) *hashtbl, *hp; + + hashtbl = vhashtbl; + for (hp = hashtbl; hp <= &hashtbl[hashmask]; hp++) + if (!LIST_EMPTY(hp)) + panic("hashdestroy: hash not empty"); + free(hashtbl, type); +} + static int primes[] = { 1, 13, 31, 61, 127, 251, 509, 761, 1021, 1531, 2039, 2557, 3067, 3583, 4093, 4603, 5119, 5623, 6143, 6653, 7159, 7673, 8191, 12281, 16381, 24571, 32749 }; |