36
36
typedef struct HashTable HashTable;
37
38
typedef void (*HashTableFreeEntryFn)(void *clientData);
38
typedef int (*HashTableForEachCallback)(const char *key, void *value,
40
typedef int (*HashTableForEachCallback)(const char *key,
41
44
#define HASH_STRING_KEY 0 // case-sensitive string key
125
128
HashTableForEachCallback cb,
126
129
void *clientData);
132
* Specialize hash table that uses the callers data structure as its
133
* hash entry as well, the hash key being an address that must be unique.
136
typedef struct PtrHashEntry
138
struct PtrHashEntry *next;
143
* PTRHASH_CONTAINER - get the struct for this entry (like PtrHashEntry)
144
* @ptr: the &struct PtrHashEntry pointer.
145
* @type: the type of the struct this is embedded in.
146
* @member: the name of the list struct within the struct.
149
#define PTRHASH_CONTAINER(ptr, type, member) \
150
((type *)((char *)(ptr) - offsetof(type, member)))
152
typedef int (*PtrHashForEachCallback)(PtrHashEntry *entry,
153
const void *clientData);
155
HashTable *PtrHash_Alloc(uint32 numBuckets);
157
void PtrHash_Free(HashTable *hashTable);
159
size_t PtrHash_GetNumElements(const HashTable *ht);
161
int PtrHash_ForEach(const HashTable *ht,
162
PtrHashForEachCallback cb,
163
const void *clientData);
165
PtrHashEntry *PtrHash_Lookup(const HashTable *hashTable,
168
PtrHashEntry *PtrHash_LookupAndDelete(HashTable *hashTable,
171
Bool PtrHash_Insert(HashTable *hashTable,
172
PtrHashEntry *entry);
174
Bool PtrHash_Delete(HashTable *hashTable,