dovecot: Use mail_index_ext_get_reset_id() to get the current re...

dovecot at dovecot.org dovecot at dovecot.org
Mon Aug 6 17:30:08 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/b31c368b150b
changeset: 6172:b31c368b150b
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Aug 06 17:30:03 2007 +0300
description:
Use mail_index_ext_get_reset_id() to get the current reset_id, so we get the
correct one in case it has been updated for current transaction already.
Also fixes an assert-crash in case the cache extension didn't yet even exist
outside the transaction.

diffstat:

1 file changed, 3 insertions(+), 5 deletions(-)
src/lib-index/mail-cache-lookup.c |    8 +++-----

diffs (32 lines):

diff -r 635b58fe8287 -r b31c368b150b src/lib-index/mail-cache-lookup.c
--- a/src/lib-index/mail-cache-lookup.c	Mon Aug 06 17:28:55 2007 +0300
+++ b/src/lib-index/mail-cache-lookup.c	Mon Aug 06 17:30:03 2007 +0300
@@ -53,9 +53,8 @@ mail_cache_lookup_offset(struct mail_cac
 			 uint32_t seq, uint32_t *offset_r)
 {
 	struct mail_index_map *map;
-	const struct mail_index_ext *ext;
 	const void *data;
-	uint32_t idx;
+	uint32_t reset_id;
 	int i, ret;
 
 	if (mail_index_lookup_ext_full(view, seq, cache->ext_id,
@@ -66,15 +65,14 @@ mail_cache_lookup_offset(struct mail_cac
 		return 0;
 	}
 
-	if (!mail_index_map_get_ext_idx(map, cache->ext_id, &idx))
+	if (!mail_index_ext_get_reset_id(view, cache->ext_id, &reset_id))
 		i_unreached();
-	ext = array_idx(&map->extensions, idx);
 
 	/* reset_id must match file_seq or the offset is for a different cache
 	   file. if this happens, try if reopening the cache helps. if not,
 	   it was probably for an old cache file that's already lost by now. */
 	i = 0;
-	while (cache->hdr->file_seq != ext->reset_id) {
+	while (cache->hdr->file_seq != reset_id) {
 		if (++i == 2)
 			return 0;
 


More information about the dovecot-cvs mailing list