xref: /freebsd/crypto/krb5/src/plugins/kdb/db2/libdb2/hash/search.h (revision 7f2fe78b9dd5f51c821d771b63d2e096f6fd49e9)
1*7f2fe78bSCy Schubert /*-
2*7f2fe78bSCy Schubert  * Copyright (c) 1990, 1993
3*7f2fe78bSCy Schubert  *	The Regents of the University of California.  All rights reserved.
4*7f2fe78bSCy Schubert  *
5*7f2fe78bSCy Schubert  * This code is derived from software contributed to Berkeley by
6*7f2fe78bSCy Schubert  * Margo Seltzer.
7*7f2fe78bSCy Schubert  *
8*7f2fe78bSCy Schubert  * Redistribution and use in source and binary forms, with or without
9*7f2fe78bSCy Schubert  * modification, are permitted provided that the following conditions
10*7f2fe78bSCy Schubert  * are met:
11*7f2fe78bSCy Schubert  * 1. Redistributions of source code must retain the above copyright
12*7f2fe78bSCy Schubert  *    notice, this list of conditions and the following disclaimer.
13*7f2fe78bSCy Schubert  * 2. Redistributions in binary form must reproduce the above copyright
14*7f2fe78bSCy Schubert  *    notice, this list of conditions and the following disclaimer in the
15*7f2fe78bSCy Schubert  *    documentation and/or other materials provided with the distribution.
16*7f2fe78bSCy Schubert  * 3. All advertising materials mentioning features or use of this software
17*7f2fe78bSCy Schubert  *    must display the following acknowledgement:
18*7f2fe78bSCy Schubert  *	This product includes software developed by the University of
19*7f2fe78bSCy Schubert  *	California, Berkeley and its contributors.
20*7f2fe78bSCy Schubert  * 4. Neither the name of the University nor the names of its contributors
21*7f2fe78bSCy Schubert  *    may be used to endorse or promote products derived from this software
22*7f2fe78bSCy Schubert  *    without specific prior written permission.
23*7f2fe78bSCy Schubert  *
24*7f2fe78bSCy Schubert  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25*7f2fe78bSCy Schubert  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26*7f2fe78bSCy Schubert  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27*7f2fe78bSCy Schubert  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28*7f2fe78bSCy Schubert  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29*7f2fe78bSCy Schubert  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30*7f2fe78bSCy Schubert  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31*7f2fe78bSCy Schubert  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32*7f2fe78bSCy Schubert  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33*7f2fe78bSCy Schubert  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34*7f2fe78bSCy Schubert  * SUCH DAMAGE.
35*7f2fe78bSCy Schubert  *
36*7f2fe78bSCy Schubert  *	@(#)search.h	8.1 (Berkeley) 6/4/93
37*7f2fe78bSCy Schubert  */
38*7f2fe78bSCy Schubert 
39*7f2fe78bSCy Schubert /* Backward compatibility to hsearch interface. */
40*7f2fe78bSCy Schubert typedef struct entry {
41*7f2fe78bSCy Schubert 	char *key;
42*7f2fe78bSCy Schubert 	char *data;
43*7f2fe78bSCy Schubert } ENTRY;
44*7f2fe78bSCy Schubert 
45*7f2fe78bSCy Schubert typedef enum {
46*7f2fe78bSCy Schubert 	FIND, ENTER
47*7f2fe78bSCy Schubert } ACTION;
48*7f2fe78bSCy Schubert 
49*7f2fe78bSCy Schubert #define hcreate		kdb2_hcreate
50*7f2fe78bSCy Schubert #define hdestroy	kdb2_hdestroy
51*7f2fe78bSCy Schubert #define hsearch		kdb2_hsearch
52*7f2fe78bSCy Schubert 
53*7f2fe78bSCy Schubert int	 hcreate __P((unsigned int));
54*7f2fe78bSCy Schubert void	 hdestroy __P((void));
55*7f2fe78bSCy Schubert ENTRY	*hsearch __P((ENTRY, ACTION));
56