diff options
author | Thomas Roessler <roessler@does-not-exist.org> | 2005-07-24 15:46:26 +0000 |
---|---|---|
committer | Thomas Roessler <roessler@does-not-exist.org> | 2005-07-24 15:46:26 +0000 |
commit | 748048778d7d9f76ee0886af3318bef78aa950df (patch) | |
tree | 9e3c1cbb78363334ab0b4a41efe145a5d777923e /hash.c | |
parent | 961773894640ee288bc33a40d9b03b9de9db018e (diff) |
This patch includes (1) a rewrite of hash_delete_hash, and (2) some
changes to the IMAP code that Thomas Glanzmann made during an
attempt to squash some segmentation fault in May. There is no
guarantee that this patch doesn't break things. If it does, please
complain to mutt-dev.
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -117,18 +117,22 @@ void hash_delete_hash (HASH * table, int hash, const char *key, const void *data struct hash_elem *ptr = table->table[hash]; struct hash_elem **last = &table->table[hash]; - for (; ptr; last = &ptr->next, ptr = ptr->next) + while (ptr) { - /* if `data' is given, look for a matching ->data member. this is - * required for the case where we have multiple entries with the same - * key - */ - if ((data == ptr->data) || (!data && mutt_strcmp (ptr->key, key) == 0)) + if ((data == ptr->data || !data) + && mutt_strcmp (ptr->key, key) == 0) { *last = ptr->next; - if (destroy) destroy (ptr->data); + if (destroy) + destroy (ptr->data); FREE (&ptr); - return; + + ptr = *last; + } + else + { + last = &ptr->next; + ptr = ptr->next; } } } |