/[cvs]/eggdrop1.9/src/egglib/hash_table.h
ViewVC logotype

Contents of /eggdrop1.9/src/egglib/hash_table.h

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Sun Oct 28 13:30:35 2001 UTC (17 years, 11 months ago) by ite
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/x-csrc
FILE REMOVED
Renamed src/adns, src/compat, src/egglib to lib/adns, lib/compat, lib/egglib respectively.

1 #ifndef _HASH_TABLE_H_
2 #define _HASH_TABLE_H_
3
4 #define HASH_TABLE_STRINGS 1
5 #define HASH_TABLE_INTS 2
6 #define HASH_TABLE_MIXED 4
7
8 /* Turns a key into an unsigned int. */
9 typedef unsigned int (*hash_table_hash_alg)(void *key);
10
11 /* Returns -1, 0, or 1 if left is <, =, or > than right. */
12 typedef int (*hash_table_cmp_alg)(const void *left, const void *right);
13
14 typedef int (*hash_table_node_func)(const void *key, void *data, void *param);
15
16 typedef struct hash_table_entry_b {
17 struct hash_table_entry_b *next;
18 void *key;
19 void *data;
20 } hash_table_entry_t;
21
22 typedef struct hash_table_b {
23 int flags;
24 int max_rows;
25 int rows_in_use;
26 int collisions;
27 hash_table_hash_alg hash;
28 hash_table_cmp_alg cmp;
29 hash_table_entry_t entries[1];
30 } hash_table_t;
31
32 hash_table_t *hash_table_create(hash_table_hash_alg alg, hash_table_cmp_alg cmp, int nrows, int flags);
33 int hash_table_destroy(hash_table_t *ht);
34 int hash_table_insert(hash_table_t *ht, void *key, void *data);
35 int hash_table_replace(hash_table_t *ht, void *key, void *data);
36 int hash_table_find(hash_table_t *ht, void *key, void *dataptr);
37 int hash_table_delete(hash_table_t *ht, void *key);
38
39 static unsigned int my_string_hash(void *key);
40 static unsigned int my_int_hash(void *key);
41 static unsigned int my_mixed_hash (void *key);
42
43 static int my_int_cmp(const void *left, const void *right);
44
45 #endif /* _HASH_TABLE_H_ */

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23