xref: /titanic_50/usr/src/cmd/sgs/link_audit/common/hash.h (revision c39526b769298791ff5b0b6c5e761f49aabaeb4e)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1996 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #pragma	ident	"%Z%%M%	%I%	%E% SMI"
28 
29 /*
30   @(#)SSM2 hash.h 1.2 90/11/13
31 */
32 
33 /*
34  * File: hash.h
35  *
36  * Copyright (C) 1990 Sun Microsystems Inc.
37  * All Rights Reserved.
38  */
39 
40 
41 /*
42  *    Change Log
43  * ============================================================================
44  * Author      Date       Change
45  * barts     13 Nov 90	  Created.
46  *
47  */
48 
49 #ifndef _hash_h
50 #define _hash_h
51 
52 typedef struct hash_entry {
53   struct hash_entry
54     * next_entry,
55     * right_entry,
56     * left_entry;
57   char *       	key;
58   char * 	data;
59 } hash_entry;
60 
61 typedef struct hash {
62   size_t	size;
63   hash_entry ** table;
64   hash_entry * 	start;
65   enum hash_type { String_Key = 0 , Integer_Key = 1} hash_type;
66 } hash;
67 
68 hash * 		make_hash(size_t size);
69 hash * 		make_ihash(size_t size);
70 char ** 	get_hash(hash * tbl, char * key);
71 char **		find_hash(hash * tbl, const char * key);
72 char *		del_hash(hash * tbl, const char * key);
73 size_t 		operate_hash(hash * tbl, void (*ptr)(), const char * usr_arg);
74 void 		destroy_hash(hash * tbl, int (*ptr)(), const char * usr_arg);
75 
76 #endif /* _hash_h */
77 
78 
79 
80 
81 
82 
83 
84 
85 
86