diff --git a/doc/en/weechat_plugin_api.en.asciidoc b/doc/en/weechat_plugin_api.en.asciidoc index 4f9c75a8a..9bc9584d3 100644 --- a/doc/en/weechat_plugin_api.en.asciidoc +++ b/doc/en/weechat_plugin_api.en.asciidoc @@ -3812,7 +3812,14 @@ my_free_value_cb (struct t_hashtable *hashtable, const void *key, void *value) /* ... */ } +void +my_free_key_cb (struct t_hashtable *hashtable, void *key) +{ + /* ... */ +} + weechat_hashtable_set_pointer (hashtable, "callback_free_value", &my_free_value_cb); +weechat_hashtable_set_pointer (hashtable, "callback_free_key", &my_free_key_cb); ---- [NOTE] diff --git a/src/core/wee-hashtable.c b/src/core/wee-hashtable.c index b18666fe9..1c4095f24 100644 --- a/src/core/wee-hashtable.c +++ b/src/core/wee-hashtable.c @@ -307,8 +307,7 @@ hashtable_free_key (struct t_hashtable *hashtable, if (hashtable->callback_free_key) { (void) (hashtable->callback_free_key) (hashtable, - item->key, - item->value); + item->key); } else { diff --git a/src/core/wee-hashtable.h b/src/core/wee-hashtable.h index 20f6ec05b..937867858 100644 --- a/src/core/wee-hashtable.h +++ b/src/core/wee-hashtable.h @@ -28,7 +28,7 @@ typedef unsigned long long (t_hashtable_hash_key)(struct t_hashtable *hashtable, typedef int (t_hashtable_keycmp)(struct t_hashtable *hashtable, const void *key1, const void *key2); typedef void (t_hashtable_free_key)(struct t_hashtable *hashtable, - void *key, const void *value); + void *key); typedef void (t_hashtable_free_value)(struct t_hashtable *hashtable, const void *key, void *value); typedef void (t_hashtable_map)(void *data, diff --git a/src/core/wee-string.c b/src/core/wee-string.c index 5cab4a35d..dc184b9ca 100644 --- a/src/core/wee-string.c +++ b/src/core/wee-string.c @@ -2815,12 +2815,10 @@ string_shared_keycmp (struct t_hashtable *hashtable, */ void -string_shared_free_key (struct t_hashtable *hashtable, - void *key, const void *value) +string_shared_free_key (struct t_hashtable *hashtable, void *key) { /* make C compiler happy */ (void) hashtable; - (void) value; free (key); }