xref: /openbsd-src/usr.bin/ctfconv/hash.h (revision 0687c322e07315b8b2d5d0eb4cd12f6106989d1c)
1*0687c322Sjasper /*	$OpenBSD: hash.h,v 1.2 2017/08/11 14:58:56 jasper Exp $ */
2*0687c322Sjasper 
3192095f7Smpi /*
4192095f7Smpi  * Copyright (c) 2017 Martin Pieuchot
5192095f7Smpi  *
6192095f7Smpi  * Permission to use, copy, modify, and distribute this software for any
7192095f7Smpi  * purpose with or without fee is hereby granted, provided that the above
8192095f7Smpi  * copyright notice and this permission notice appear in all copies.
9192095f7Smpi  *
10192095f7Smpi  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11192095f7Smpi  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12192095f7Smpi  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13192095f7Smpi  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14192095f7Smpi  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15192095f7Smpi  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16192095f7Smpi  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17192095f7Smpi  */
18192095f7Smpi 
19192095f7Smpi struct hash;
20192095f7Smpi 
21192095f7Smpi struct hash_entry {
22192095f7Smpi 	const char *hkey;
23192095f7Smpi };
24192095f7Smpi 
25192095f7Smpi struct hash *hash_init(unsigned);
26192095f7Smpi void hash_delete(struct hash *);
27192095f7Smpi 
28192095f7Smpi void *hash_first(struct hash *, unsigned int *);
29192095f7Smpi void *hash_next(struct hash *, unsigned int *);
30192095f7Smpi struct hash_entry *hash_find(struct hash *, const char *, unsigned int *);
31192095f7Smpi void *hash_remove(struct hash *, unsigned int);
32192095f7Smpi void hash_insert(struct hash *, unsigned int, struct hash_entry *, const char *);
33