From: Pekka Riikonen Date: Sun, 3 Dec 2006 20:50:21 +0000 (+0000) Subject: Simplified silc_idcache_update interface, the old values are not X-Git-Tag: silc.client.1.1.beta1~144 X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=71d1fefe6029e201edca6a93f39a0646a40c294b Simplified silc_idcache_update interface, the old values are not needed anymore. --- diff --git a/lib/silcapputil/silcidcache.c b/lib/silcapputil/silcidcache.c index 5e662947..0c733276 100644 --- a/lib/silcapputil/silcidcache.c +++ b/lib/silcapputil/silcidcache.c @@ -222,12 +222,11 @@ SilcBool silc_idcache_del_by_context(SilcIDCache cache, void *context, /* Update entry */ SilcBool silc_idcache_update(SilcIDCache cache, SilcIDCacheEntry entry, - void *old_id, void *new_id, - char *old_name, char *new_name, + void *new_id, char *new_name, SilcBool free_old_name) { - if (old_id && new_id) { - if (!silc_hash_table_del_by_context(cache->id_table, old_id, entry)) + if (new_id) { + if (!silc_hash_table_del_by_context(cache->id_table, entry->id, entry)) return FALSE; if (cache->id_type == SILC_ID_CLIENT) @@ -241,8 +240,8 @@ SilcBool silc_idcache_update(SilcIDCache cache, SilcIDCacheEntry entry, return FALSE; } - if (old_name && new_name) { - if (!silc_hash_table_del_by_context(cache->name_table, old_name, entry)) + if (new_name) { + if (!silc_hash_table_del_by_context(cache->name_table, entry->name, entry)) return FALSE; if (free_old_name) @@ -259,8 +258,7 @@ SilcBool silc_idcache_update(SilcIDCache cache, SilcIDCacheEntry entry, /* Update entry by context */ SilcBool silc_idcache_update_by_context(SilcIDCache cache, void *context, - void *old_id, void *new_id, - char *old_name, char *new_name, + void *new_id, char *new_name, SilcBool free_old_name) { SilcIDCacheEntry c; @@ -268,8 +266,7 @@ SilcBool silc_idcache_update_by_context(SilcIDCache cache, void *context, if (!silc_hash_table_find(cache->context_table, context, NULL, (void **)&c)) return FALSE; - return silc_idcache_update(cache, c, old_id, new_id, old_name, new_name, - free_old_name); + return silc_idcache_update(cache, c, new_id, new_name, free_old_name); } /* Returns all cache entrys from the ID cache to the `ret' ID Cache List. */ diff --git a/lib/silcapputil/silcidcache.h b/lib/silcapputil/silcidcache.h index 6fcaa573..b9fff272 100644 --- a/lib/silcapputil/silcidcache.h +++ b/lib/silcapputil/silcidcache.h @@ -205,8 +205,7 @@ SilcBool silc_idcache_del_by_context(SilcIDCache cache, void *context, * SYNOPSIS * * SilcBool silc_idcache_update(SilcIDCache cache, SilcIDCacheEntry entry, - * void *old_id, void *new_id, - * char *old_name, char *new_name, + * void *new_id, char *new_name, * SilcBool free_old_name); * * DESCRIPTION @@ -221,8 +220,7 @@ SilcBool silc_idcache_del_by_context(SilcIDCache cache, void *context, * ***/ SilcBool silc_idcache_update(SilcIDCache cache, SilcIDCacheEntry entry, - void *old_id, void *new_id, - char *old_name, char *new_name, + void *new_id, char *new_name, SilcBool free_old_name); /****f* silcapputil/SilcIDCacheAPI/silc_idcache_update @@ -231,8 +229,7 @@ SilcBool silc_idcache_update(SilcIDCache cache, SilcIDCacheEntry entry, * * SilcBool * silc_idcache_update_by_context(SilcIDCache cache, void *context, - * void *old_id, void *new_id, - * char *old_name, char *new_name, + * void *new_id, char *new_name, * SilcBool free_old_name); * * DESCRIPTION @@ -242,8 +239,7 @@ SilcBool silc_idcache_update(SilcIDCache cache, SilcIDCacheEntry entry, * ***/ SilcBool silc_idcache_update_by_context(SilcIDCache cache, void *context, - void *old_id, void *new_id, - char *old_name, char *new_name, + void *new_id, char *new_name, SilcBool free_old_name); /****f* silcapputil/SilcIDCacheAPI/silc_idcache_get_all