diff options
author | Simo Sorce <ssorce@redhat.com> | 2009-12-08 14:05:22 -0500 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2009-12-08 23:35:30 -0500 |
commit | 4a5e256201c886d09a8dadd3f299baadde506a2f (patch) | |
tree | e78333c8b8fac1e468244337819cb863e7babc62 /dhash/dhash.h | |
parent | 34d3eb975ec23c9875d54226a5b625a2f9b4ad51 (diff) | |
download | ding-libs-4a5e256201c886d09a8dadd3f299baadde506a2f.tar.gz ding-libs-4a5e256201c886d09a8dadd3f299baadde506a2f.tar.xz ding-libs-4a5e256201c886d09a8dadd3f299baadde506a2f.zip |
dhash: Add private pointer for delete callback
Also pass a flag to the delete callback to tell it if this is a normal
entry removal or we are cleaning up the tbale definitively.
Diffstat (limited to 'dhash/dhash.h')
-rw-r--r-- | dhash/dhash.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/dhash/dhash.h b/dhash/dhash.h index a8b0d83..72b054e 100644 --- a/dhash/dhash.h +++ b/dhash/dhash.h @@ -97,6 +97,12 @@ typedef enum HASH_VALUE_DOUBLE } hash_value_enum; +typedef enum +{ + HASH_TABLE_DESTROY, + HASH_ENTRY_DESTROY +} hash_destroy_enum; + typedef struct hash_key_t { hash_key_enum type; union { @@ -135,7 +141,8 @@ typedef struct hash_statistics_t { /* typedef's for callback based iteration */ typedef bool(*hash_iterate_callback)(hash_entry_t *item, void *user_data); -typedef void (*hash_delete_callback)(hash_entry_t *item); +typedef void (hash_delete_callback)(hash_entry_t *item, + hash_destroy_enum type, void *pvt); /* typedef's for iteration object based iteration */ struct hash_iter_context_t; @@ -172,7 +179,8 @@ const char* hash_error_string(int error); * may need to be disposed of. The delete_callback may be NULL. */ int hash_create(unsigned long count, hash_table_t **tbl, - hash_delete_callback delete_callback); + hash_delete_callback *delete_callback, + void *delete_private_data); /* * Create a new hash table and fine tune it's configurable parameters. @@ -197,7 +205,8 @@ int hash_create_ex(unsigned long count, hash_table_t **tbl, hash_alloc_func *alloc_func, hash_free_func *free_func, void *alloc_private_data, - hash_delete_callback delete_callback); + hash_delete_callback *delete_callback, + void *delete_private_data); #ifdef HASH_STATISTICS /* |