changeset 6172:b31c368b150b HEAD

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.
author Timo Sirainen <tss@iki.fi>
date Mon, 06 Aug 2007 17:30:03 +0300
parents 635b58fe8287
children 370691a10003
files src/lib-index/mail-cache-lookup.c
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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 @@
 			 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 @@
 		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;