7 typedef struct _DviHashBucket DviHashBucket;
8 typedef struct _DviHashTable DviHashTable;
14 typedef Uchar *DviHashKey;
15 #define MDVI_KEY(x) ((DviHashKey)(x))
17 typedef Ulong (*DviHashFunc) __PROTO((DviHashKey key));
18 typedef int (*DviHashComp) __PROTO((DviHashKey key1, DviHashKey key2));
19 typedef void (*DviHashFree) __PROTO((DviHashKey key, void *data));
22 struct _DviHashTable {
23 DviHashBucket **buckets;
26 DviHashFunc hash_func;
27 DviHashComp hash_comp;
28 DviHashFree hash_free;
30 #define MDVI_EMPTY_HASH_TABLE {NULL, 0, 0, NULL, NULL, NULL}
32 #define MDVI_HASH_REPLACE 0
33 #define MDVI_HASH_UNIQUE 1
34 #define MDVI_HASH_UNCHECKED 2
36 extern void mdvi_hash_init __PROTO((DviHashTable *));
37 extern void mdvi_hash_create __PROTO((DviHashTable *, int));
38 extern int mdvi_hash_add __PROTO((DviHashTable *, DviHashKey, void *, int));
39 extern int mdvi_hash_destroy_key __PROTO((DviHashTable *, DviHashKey));
40 extern void mdvi_hash_reset __PROTO((DviHashTable *, int));
41 extern void *mdvi_hash_lookup __PROTO((DviHashTable *, DviHashKey));
42 extern void *mdvi_hash_remove __PROTO((DviHashTable *, DviHashKey));
43 extern void *mdvi_hash_remove_ptr __PROTO((DviHashTable *, DviHashKey));
45 #define mdvi_hash_flush(h) mdvi_hash_reset((h), 1)
46 #define mdvi_hash_destroy(h) mdvi_hash_reset((h), 0)