hash.h revision ea6ae205
1ea6ae205Smrg/*
2ea6ae205Smrg  Copyright (c) 2003 by Juliusz Chroboczek
3ea6ae205Smrg
4ea6ae205Smrg  Permission is hereby granted, free of charge, to any person obtaining a copy
5ea6ae205Smrg  of this software and associated documentation files (the "Software"), to deal
6ea6ae205Smrg  in the Software without restriction, including without limitation the rights
7ea6ae205Smrg  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8ea6ae205Smrg  copies of the Software, and to permit persons to whom the Software is
9ea6ae205Smrg  furnished to do so, subject to the following conditions:
10ea6ae205Smrg
11ea6ae205Smrg  The above copyright notice and this permission notice shall be included in
12ea6ae205Smrg  all copies or substantial portions of the Software.
13ea6ae205Smrg
14ea6ae205Smrg  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15ea6ae205Smrg  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16ea6ae205Smrg  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17ea6ae205Smrg  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18ea6ae205Smrg  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19ea6ae205Smrg  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20ea6ae205Smrg  THE SOFTWARE.
21ea6ae205Smrg*/
22ea6ae205Smrg/* $XFree86$ */
23ea6ae205Smrg
24ea6ae205Smrg#ifndef _MKS_HASH_H_
25ea6ae205Smrg#define _MKS_HASH_H_ 1
26ea6ae205Smrg
27ea6ae205Smrgtypedef struct _HashBucket {
28ea6ae205Smrg    char *key;
29ea6ae205Smrg    char *value;
30ea6ae205Smrg    int prio;
31ea6ae205Smrg    struct _HashBucket *next;
32ea6ae205Smrg} HashBucketRec, *HashBucketPtr;
33ea6ae205Smrg
34ea6ae205Smrgtypedef HashBucketPtr* HashTablePtr;
35ea6ae205Smrg
36ea6ae205SmrgHashTablePtr makeHashTable(void);
37ea6ae205Smrgvoid destroyHashTable(HashTablePtr table);
38ea6ae205Smrgchar *getHash(HashTablePtr table, char *key);
39ea6ae205Smrgint putHash(HashTablePtr table, char *key, char *value, int prio);
40ea6ae205Smrgint hashElements(HashTablePtr table);
41ea6ae205SmrgHashBucketPtr *hashArray(HashTablePtr table, int value_first);
42ea6ae205Smrgvoid destroyHashArray(HashBucketPtr *array);
43ea6ae205Smrg
44ea6ae205Smrg#endif /* _MKS_HASH_H */
45