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