dovecot-2.0: priority queue: Set item's idx value to invalid whe...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Oct 4 19:16:41 EEST 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/4db5123f91e4
changeset: 12241:4db5123f91e4
user: Timo Sirainen <tss at iki.fi>
date: Mon Oct 04 17:16:38 2010 +0100
description:
priority queue: Set item's idx value to invalid when it's removed from queue.
This should assert-crash on double-removes more reliably.
diffstat:
src/lib/priorityq.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diffs (23 lines):
diff -r 1f784904111b -r 4db5123f91e4 src/lib/priorityq.c
--- 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;
}
More information about the dovecot-cvs
mailing list