summaryrefslogtreecommitdiffstats
path: root/common/dhash/dhash_example.c
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-12-08 14:05:22 -0500
committerStephen Gallagher <sgallagh@redhat.com>2009-12-08 23:35:30 -0500
commit4fdcab8ba579b481870d5a6a422fcca70712d30f (patch)
treee037f61d3f660cdd5011c0c56ae4819067b2614d /common/dhash/dhash_example.c
parent4532cccb737b60330b43e886a82e28458ca3b956 (diff)
downloadsssd-4fdcab8ba579b481870d5a6a422fcca70712d30f.tar.gz
sssd-4fdcab8ba579b481870d5a6a422fcca70712d30f.tar.xz
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_example.c')
-rw-r--r--common/dhash/dhash_example.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/common/dhash/dhash_example.c b/common/dhash/dhash_example.c
index b7de62356..7ed01d71a 100644
--- a/common/dhash/dhash_example.c
+++ b/common/dhash/dhash_example.c
@@ -9,7 +9,7 @@ struct my_data_t {
char bar[128];
};
-void delete_callback(hash_entry_t *entry)
+void delete_callback(hash_entry_t *entry, hash_destroy_enum type, void *pvt)
{
if (entry->value.type == HASH_VALUE_PTR) free(entry->value.ptr);
}
@@ -45,7 +45,8 @@ int main(int argc, char **argv)
unsigned long count;
/* Create a hash table */
- if ((error = hash_create(10, &table, delete_callback)) != HASH_SUCCESS) {
+ error = hash_create(10, &table, delete_callback, NULL);
+ if (error != HASH_SUCCESS) {
fprintf(stderr, "cannot create hash table (%s)\n", hash_error_string(error));
return error;
}