dovecot-2.2: mail-index: trivial paranoia check in expunge loop
dovecot at dovecot.org
dovecot at dovecot.org
Mon Jun 2 11:53:55 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/1466daa29957
changeset: 17425:1466daa29957
user: Phil Carmody <phil at dovecot.fi>
date: Mon Jun 02 14:50:34 2014 +0300
description:
mail-index: trivial paranoia check in expunge loop
We will later be moving the zone between the current seqs and the
(end of the) previous seqs - this check ensures that the range is
indeed monotonic, and thus that zone is positive in size. It can
be zero right at the start, if the first seqs is (1,...)
Based on draft patch by Timo Sirainen.
Signed-off-by: Phil Carmody <phil at dovecot.fi>
diffstat:
src/lib-index/mail-index-sync-update.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diffs (35 lines):
diff -r b4c630542488 -r 1466daa29957 src/lib-index/mail-index-sync-update.c
--- a/src/lib-index/mail-index-sync-update.c Mon Jun 02 14:50:34 2014 +0300
+++ b/src/lib-index/mail-index-sync-update.c Mon Jun 02 14:50:34 2014 +0300
@@ -241,6 +241,7 @@
struct mail_index_map *map;
const struct seq_range *range;
unsigned int i, count;
+ uint32_t prev_seq2;
map = mail_index_sync_get_atomic_map(ctx);
@@ -255,12 +256,15 @@
}
/* Preparatory HACK - do this in forward order so the memmove()s are pessimal! */
+ prev_seq2 = 0;
for (i = 0; i < count; i++) {
uint32_t seq1 = range[i].seq1;
uint32_t seq2 = range[i].seq2;
struct mail_index_record *rec;
uint32_t seq_count, seq;
+ i_assert(seq1 > prev_seq2);
+
for (seq = seq1; seq <= seq2; seq++) {
rec = MAIL_INDEX_MAP_IDX(map, seq-1);
mail_index_sync_header_update_counts(ctx, rec->uid, rec->flags, 0);
@@ -275,6 +279,7 @@
map->rec_map->records_count -= seq_count;
map->hdr.messages_count -= seq_count;
mail_index_modseq_expunge(ctx->modseq_ctx, seq1, seq2);
+ prev_seq2 = seq2;
}
}
More information about the dovecot-cvs
mailing list