Mercurial > dovecot > core-2.2
changeset 12241:4db5123f91e4
priority queue: Set item's idx value to invalid when it's removed from queue.
This should assert-crash on double-removes more reliably.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 04 Oct 2010 17:16:38 +0100 |
parents | 1f784904111b |
children | e2f9baa436f2 |
files | src/lib/priorityq.c |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib/priorityq.c Mon Oct 04 17:10:08 2010 +0100 +++ b/src/lib/priorityq.c Mon Oct 04 17:16:38 2010 +0100 @@ -136,6 +136,7 @@ void priorityq_remove(struct priorityq *pq, struct priorityq_item *item) { priorityq_remove_idx(pq, item->idx); + item->idx = -1U; } struct priorityq_item *priorityq_peek(struct priorityq *pq) @@ -154,8 +155,10 @@ struct priorityq_item *item; item = priorityq_peek(pq); - if (item != NULL) + if (item != NULL) { priorityq_remove_idx(pq, 0); + item->idx = -1U; + } return item; }