diff options
Diffstat (limited to 'ckcapi-util.h')
-rw-r--r-- | ckcapi-util.h | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/ckcapi-util.h b/ckcapi-util.h index 6ae74a0..59e660c 100644 --- a/ckcapi-util.h +++ b/ckcapi-util.h @@ -63,18 +63,31 @@ void ckcapi_array_remove_range (CkCapiArray* array, unsigned int index, struct _CkCapiHash; typedef struct _CkCapiHash CkCapiHash; +typedef unsigned int (*CkCapiHashFunc)(const void* key); + +typedef int (*CkCapiHashEqual)(const void* a, const void* b); + typedef void (*CkCapiHashDestroy)(void* val); -CkCapiHash* ckcapi_hash_new (void); +CkCapiHash* ckcapi_hash_new (CkCapiHashFunc hash_func, CkCapiHashEqual equal_func); + +void ckcapi_hash_free (CkCapiHash* ht, CkCapiHashDestroy destroy_func); + +size_t ckcapi_hash_count (CkCapiHash* ht); + +void* ckcapi_hash_get (CkCapiHash* ht, const void* key); + +int ckcapi_hash_set (CkCapiHash* ht, const void* key, void* val); -void ckcapi_hash_free (CkCapiHash* ht, CkCapiHashDestroy destroy_func); +void* ckcapi_hash_rem (CkCapiHash* ht, const void* key); -size_t ckcapi_hash_count (CkCapiHash* ht); +unsigned int ckcapi_hash_pointer (const void* ptr); -void* ckcapi_hash_get (CkCapiHash* ht, const void* key, size_t klen); +unsigned int ckcapi_hash_data (const void* data, size_t n_data); -int ckcapi_hash_set (CkCapiHash* ht, const void* key, size_t klen, void* val); +unsigned int ckcapi_hash_integer (int integer); -void* ckcapi_hash_rem (CkCapiHash* ht, const void* key, size_t klen); +#define ckcapi_hash_key(num) \ + (((char*)NULL) + (size_t)(num)) #endif /* __CKCAPI_UTIL_H__ */
\ No newline at end of file |