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 | 4fdcab8ba579b481870d5a6a422fcca70712d30f (patch) | |
tree | e037f61d3f660cdd5011c0c56ae4819067b2614d /common/dhash/dhash.h | |
parent | 4532cccb737b60330b43e886a82e28458ca3b956 (diff) | |
download | sssd-4fdcab8ba579b481870d5a6a422fcca70712d30f.tar.gz sssd-4fdcab8ba579b481870d5a6a422fcca70712d30f.tar.bz2 sssd-4fdcab8ba579b481870d5a6a422fcca70712d30f.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 'common/dhash/dhash.h')
-rw-r--r-- | common/dhash/dhash.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/common/dhash/dhash.h b/common/dhash/dhash.h index a8b0d83f..72b054e8 100644 --- a/common/dhash/dhash.h +++ b/common/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 /* |