diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2011-03-15 16:19:47 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2011-03-15 16:19:47 +0100 |
commit | 15121096d4adcfddf59141e8f1d10577320fd295 (patch) | |
tree | 4f93173b6c604738e9f56439d0a8ac7f3c8a8fea /src/core | |
parent | dd76010e085aea8522bb77134d670cc9a8d4fb8b (diff) | |
download | weechat-15121096d4adcfddf59141e8f1d10577320fd295.zip |
Allow removal of hashtable entry in callback of hashtable_map
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/wee-hashtable.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/core/wee-hashtable.c b/src/core/wee-hashtable.c index 99210cbc7..6fc09a00d 100644 --- a/src/core/wee-hashtable.c +++ b/src/core/wee-hashtable.c @@ -431,20 +431,24 @@ hashtable_map (struct t_hashtable *hashtable, void *callback_map_data) { int i; - struct t_hashtable_item *ptr_item; + struct t_hashtable_item *ptr_item, *ptr_next_item; if (!hashtable) return; for (i = 0; i < hashtable->size; i++) { - for (ptr_item = hashtable->htable[i]; ptr_item; - ptr_item = ptr_item->next_item) + ptr_item = hashtable->htable[i]; + while (ptr_item) { + ptr_next_item = ptr_item->next_item; + (void) (callback_map) (callback_map_data, hashtable, ptr_item->key, ptr_item->value); + + ptr_item = ptr_next_item; } } } |