mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-16 10:20:30 +00:00
Add a hashdestroy() function to undo the actions of hashinit().
This commit is contained in:
parent
dfc1b4ac01
commit
37777f4d1f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=99098
@ -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 };
|
||||
|
@ -123,6 +123,7 @@ int nullop(void);
|
||||
int eopnotsupp(void);
|
||||
int seltrue(dev_t dev, int which, struct thread *td);
|
||||
int ureadc(int, struct uio *);
|
||||
void hashdestroy(void *, struct malloc_type *, u_long);
|
||||
void *hashinit(int count, struct malloc_type *type, u_long *hashmask);
|
||||
void *phashinit(int count, struct malloc_type *type, u_long *nentries);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user