comparison src/hash.h @ 442:abe6d1db359e r21-2-36

Import from CVS: tag r21-2-36
author cvs
date Mon, 13 Aug 2007 11:35:02 +0200
parents 8de8e3f6228a
children b39c14581166
comparison
equal deleted inserted replaced
441:72a7cfa4a488 442:abe6d1db359e
20 #ifndef INCLUDED_hash_h_ 20 #ifndef INCLUDED_hash_h_
21 #define INCLUDED_hash_h_ 21 #define INCLUDED_hash_h_
22 22
23 typedef struct 23 typedef struct
24 { 24 {
25 CONST void *key; 25 const void *key;
26 void *contents; 26 void *contents;
27 } hentry; 27 } hentry;
28 28
29 typedef int (*hash_table_test_function) (CONST void *, CONST void *); 29 typedef int (*hash_table_test_function) (const void *, const void *);
30 typedef unsigned long (*hash_table_hash_function) (CONST void *); 30 typedef unsigned long (*hash_table_hash_function) (const void *);
31 typedef size_t hash_size_t; 31 typedef size_t hash_size_t;
32 32
33 struct hash_table 33 struct hash_table
34 { 34 {
35 hentry *harray; 35 hentry *harray;
55 55
56 /* Free HASH-TABLE and its substructures */ 56 /* Free HASH-TABLE and its substructures */
57 void free_hash_table (struct hash_table *hash_table); 57 void free_hash_table (struct hash_table *hash_table);
58 58
59 /* Returns a hentry whose key is 0 if the entry does not exist in HASH-TABLE */ 59 /* Returns a hentry whose key is 0 if the entry does not exist in HASH-TABLE */
60 CONST void *gethash (CONST void *key, struct hash_table *hash_table, 60 const void *gethash (const void *key, struct hash_table *hash_table,
61 CONST void **ret_value); 61 const void **ret_value);
62 62
63 /* KEY should be different from 0 */ 63 /* KEY should be different from 0 */
64 void puthash (CONST void *key, void *contents, struct hash_table *hash_table); 64 void puthash (const void *key, void *contents, struct hash_table *hash_table);
65 65
66 /* delete the entry with key KEY */ 66 /* delete the entry with key KEY */
67 void remhash (CONST void *key, struct hash_table *hash_table); 67 void remhash (const void *key, struct hash_table *hash_table);
68 68
69 typedef int (*maphash_function) (CONST void* key, void* contents, void* arg); 69 typedef int (*maphash_function) (const void* key, void* contents, void* arg);
70 70
71 typedef int (*remhash_predicate) (CONST void* key, CONST void* contents, 71 typedef int (*remhash_predicate) (const void* key, const void* contents,
72 void* arg); 72 void* arg);
73 73
74 /* Call MF (key, contents, arg) for every entry in HASH-TABLE */ 74 /* Call MF (key, contents, arg) for every entry in HASH-TABLE */
75 void maphash (maphash_function mf, struct hash_table *hash_table, void* arg); 75 void maphash (maphash_function mf, struct hash_table *hash_table, void* arg);
76 76