(void *)(uint32)id_type,
silc_hash_id_compare,
(void *)(uint32)id_type,
- silc_idcache_destructor, NULL);
+ silc_idcache_destructor, NULL,
+ FALSE);
cache->name_table = silc_hash_table_alloc(count, silc_hash_string, NULL,
silc_hash_string_compare, NULL,
- NULL, NULL);
+ NULL, NULL, FALSE);
cache->context_table = silc_hash_table_alloc(count, silc_hash_ptr, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, FALSE);
cache->destructor = destructor;
cache->type = id_type;
bool silc_idcache_purge_by_context(SilcIDCache cache, void *context)
{
SilcIDCacheEntry entry;
+ bool ret = FALSE;
if (!silc_hash_table_find(cache->context_table, context, NULL,
(void *)&entry))
if (cache->destructor)
cache->destructor(cache, entry);
- return silc_idcache_del(cache, entry);
+ if (entry->name)
+ ret = silc_hash_table_del_by_context(cache->name_table, entry->name,
+ entry);
+ if (entry->context)
+ ret = silc_hash_table_del(cache->context_table, entry->context);
+ if (entry->id)
+ ret = silc_hash_table_del_by_context(cache->id_table, entry->id, entry);
+
+ return ret;
}
/* Callback that is called by the hash table routine when traversing