comparison src/hash.h @ 173:8eaf7971accc r20-3b13

Import from CVS: tag r20-3b13
author cvs
date Mon, 13 Aug 2007 09:49:09 +0200
parents 376386a54a3c
children f955c73f5258
comparison
equal deleted inserted replaced
172:a38aed19690b 173:8eaf7971accc
59 59
60 /* frees the table and substructures */ 60 /* frees the table and substructures */
61 void free_hashtable (c_hashtable hash); 61 void free_hashtable (c_hashtable hash);
62 62
63 /* returns a hentry whose key is 0 if the entry does not exist in hashtable */ 63 /* returns a hentry whose key is 0 if the entry does not exist in hashtable */
64 CONST void *gethash (CONST void *key, c_hashtable hash, 64 CONST void *gethash (CONST void *key, c_hashtable hash,
65 CONST void **ret_value); 65 CONST void **ret_value);
66 66
67 /* key should be different from 0 */ 67 /* key should be different from 0 */
68 void puthash (CONST void *key, void *contents, c_hashtable hash); 68 void puthash (CONST void *key, void *contents, c_hashtable hash);
69 69
70 /* delete the entry which key is key */ 70 /* delete the entry which key is key */
71 void remhash (CONST void *key, c_hashtable hash); 71 void remhash (CONST void *key, c_hashtable hash);
72 72
73 typedef void (*maphash_function) (CONST void* key, void* contents, 73 typedef void (*maphash_function) (CONST void* key, void* contents, void* arg);
74 void* arg);
75 74
76 typedef int (*remhash_predicate) (CONST void* key, CONST void* contents, 75 typedef int (*remhash_predicate) (CONST void* key, CONST void* contents,
77 void* arg); 76 void* arg);
78 77
79 typedef void (*generic_hashtable_op) (c_hashtable table, 78 typedef void (*generic_hashtable_op) (c_hashtable table,
80 void *arg1, void *arg2, void *arg3); 79 void *arg1, void *arg2, void *arg3);
81 80
82 /* calls mf with the following arguments: key, contents, arg; for every 81 /* calls mf with the following arguments: key, contents, arg; for every
83 entry in the hashtable */ 82 entry in the hashtable */
84 void maphash (maphash_function fn, c_hashtable hash, void* arg); 83 void maphash (maphash_function fn, c_hashtable hash, void* arg);
85 84
86 /* delete objects from the table which satisfy the predicate */ 85 /* delete objects from the table which satisfy the predicate */
87 void map_remhash (remhash_predicate predicate, c_hashtable hash, void *arg); 86 void map_remhash (remhash_predicate predicate, c_hashtable hash, void *arg);
88 87
89 /* copies all the entries of src into dest -- dest is modified as needed 88 /* copies all the entries of src into dest -- dest is modified as needed
90 so it is as big as src. */ 89 so it is as big as src. */
91 void copy_hash (c_hashtable dest, c_hashtable src); 90 void copy_hash (c_hashtable dest, c_hashtable src);
92 91
93 /* makes sure that hashtable can hold at least needed_size entries */ 92 /* makes sure that hashtable can hold at least needed_size entries */
94 void expand_hashtable (c_hashtable hash, unsigned int needed_size); 93 void expand_hashtable (c_hashtable hash, unsigned int needed_size);
95 94