]>
Commit | Line | Data |
---|---|---|
51631861 A |
1 | /* |
2 | * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * This file contains Original Code and/or Modifications of Original Code | |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. Please obtain a copy of the License at | |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
11 | * file. | |
12 | * | |
13 | * The Original Code and all software distributed under the License are | |
14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
18 | * Please see the License for the specific language governing rights and | |
19 | * limitations under the License. | |
20 | * | |
21 | * @APPLE_LICENSE_HEADER_END@ | |
22 | */ | |
9385eb3d A |
23 | #ifndef _STRHASH_H_INCLUDE |
24 | #define _STRHASH_H_INCLUDE | |
25 | ||
26 | /* $FreeBSD: /repoman/r/ncvs/src/include/strhash.h,v 1.3 1999/08/28 04:59:30 peter Exp $ */ | |
27 | ||
28 | /* | |
29 | * | |
30 | * Copyright 1990 | |
31 | * Terry Jones & Jordan Hubbard | |
32 | * | |
33 | * PCS Computer Systeme, GmbH. | |
34 | * Munich, West Germany | |
35 | * | |
36 | * | |
37 | * All rights reserved. | |
38 | * | |
39 | * This is unsupported software and is subject to change without notice. | |
40 | * the author makes no representations about the suitability of this software | |
41 | * for any purpose. It is supplied "as is" without express or implied | |
42 | * warranty. | |
43 | * | |
44 | * Permission to use, copy, modify, and distribute this software and its | |
45 | * documentation for any purpose and without fee is hereby granted, provided | |
46 | * that the above copyright notice appear in all copies and that both that | |
47 | * copyright notice and this permission notice appear in supporting | |
48 | * documentation, and that the name of the author not be used in | |
49 | * advertising or publicity pertaining to distribution of the software | |
50 | * without specific, written prior permission. | |
51 | * | |
52 | */ | |
53 | ||
54 | /* | |
55 | * This is the definition file for hash.c. The plunderer from down-under | |
56 | * did the code, I just helped define the spec. That's why his name gets | |
57 | * to go first. | |
58 | */ | |
59 | ||
60 | #define HASH_SZ 97 | |
61 | ||
62 | typedef struct _node { | |
63 | char *key; | |
64 | void *data; | |
65 | struct _node *next; | |
66 | } hash_node; | |
67 | ||
68 | typedef struct { | |
69 | int size; | |
70 | hash_node **buckets; | |
71 | } hash_table; | |
72 | ||
73 | #include <sys/cdefs.h> | |
74 | ||
75 | __BEGIN_DECLS | |
76 | hash_table *hash_create(int size); | |
77 | void hash_destroy(hash_table *table, char *key, | |
78 | void (*nukefunc)(char *k, void *d)); | |
79 | void *hash_search(hash_table *table, char *key, void *datum, | |
80 | void (*replace_func)(void *d)); | |
81 | void hash_traverse(hash_table *table, | |
82 | int (*func)(char *k, void *d, void *arg), void *arg); | |
83 | void hash_purge(hash_table *table, void (*purge_func)(char *k, void *d)); | |
84 | ||
85 | #ifdef HASH_STATS | |
86 | extern void hash_stats(); | |
87 | #endif | |
88 | __END_DECLS | |
89 | ||
90 | #endif /* _STRHASH_H_INCLUDE */ |