dovecot-1.2: mail_index_record_map_move_to_private(): Drop messa...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Jun 17 15:31:11 EEST 2008
details: http://hg.dovecot.org/dovecot-1.2/rev/b8262c3a36f3
changeset: 7881:b8262c3a36f3
user: Timo Sirainen <tss at iki.fi>
date: Tue Jun 17 13:59:47 2008 +0300
description:
mail_index_record_map_move_to_private(): Drop messages from record_map the
map hasn't itself seen yet.
diffstat:
1 file changed, 23 insertions(+), 10 deletions(-)
src/lib-index/mail-index-map.c | 33 +++++++++++++++++++++++----------
diffs (43 lines):
diff -r cca4ef877d43 -r b8262c3a36f3 src/lib-index/mail-index-map.c
--- a/src/lib-index/mail-index-map.c Tue Jun 17 13:57:48 2008 +0300
+++ b/src/lib-index/mail-index-map.c Tue Jun 17 13:59:47 2008 +0300
@@ -1134,16 +1134,29 @@ void mail_index_record_map_move_to_priva
void mail_index_record_map_move_to_private(struct mail_index_map *map)
{
struct mail_index_record_map *new_map;
-
- if (array_count(&map->rec_map->maps) == 1)
- return;
-
- new_map = mail_index_record_map_alloc(map);
- mail_index_map_copy_records(new_map, map->rec_map,
- map->hdr.record_size);
-
- mail_index_record_map_unlink(map);
- map->rec_map = new_map;
+ const struct mail_index_record *rec;
+
+ if (array_count(&map->rec_map->maps) > 1) {
+ new_map = mail_index_record_map_alloc(map);
+ mail_index_map_copy_records(new_map, map->rec_map,
+ map->hdr.record_size);
+ mail_index_record_map_unlink(map);
+ map->rec_map = new_map;
+ } else {
+ new_map = map->rec_map;
+ }
+
+ if (new_map->records_count != map->hdr.messages_count) {
+ new_map->records_count = map->hdr.messages_count;
+ if (new_map->records_count == 0)
+ new_map->last_appended_uid = 0;
+ else {
+ rec = MAIL_INDEX_MAP_IDX(map, new_map->records_count-1);
+ new_map->last_appended_uid = rec->uid;
+ }
+ buffer_set_used_size(new_map->buffer, new_map->records_count *
+ map->hdr.record_size);
+ }
}
void mail_index_map_move_to_memory(struct mail_index_map *map)
More information about the dovecot-cvs
mailing list