1*71dafaa1Schristos /* $OpenBSD: ohash_delete.c,v 1.2 2004/06/22 20:00:16 espie Exp $ */
2*71dafaa1Schristos /* ex:ts=8 sw=4:
3*71dafaa1Schristos */
4*71dafaa1Schristos
5*71dafaa1Schristos /* Copyright (c) 1999, 2004 Marc Espie <espie@openbsd.org>
6*71dafaa1Schristos *
7*71dafaa1Schristos * Permission to use, copy, modify, and distribute this software for any
8*71dafaa1Schristos * purpose with or without fee is hereby granted, provided that the above
9*71dafaa1Schristos * copyright notice and this permission notice appear in all copies.
10*71dafaa1Schristos *
11*71dafaa1Schristos * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12*71dafaa1Schristos * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13*71dafaa1Schristos * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14*71dafaa1Schristos * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15*71dafaa1Schristos * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16*71dafaa1Schristos * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17*71dafaa1Schristos * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18*71dafaa1Schristos */
19*71dafaa1Schristos
20*71dafaa1Schristos #include "ohash_int.h"
21*71dafaa1Schristos /* hash_delete only frees the hash structure. Use hash_first/hash_next
22*71dafaa1Schristos * to free entries as well. */
23*71dafaa1Schristos void
ohash_delete(struct ohash * h)24*71dafaa1Schristos ohash_delete(struct ohash *h)
25*71dafaa1Schristos {
26*71dafaa1Schristos (h->info.hfree)(h->t, sizeof(struct _ohash_record) * h->size,
27*71dafaa1Schristos h->info.data);
28*71dafaa1Schristos #ifndef NDEBUG
29*71dafaa1Schristos h->t = NULL;
30*71dafaa1Schristos #endif
31*71dafaa1Schristos }
32