Mercurial > dovecot > original-hg > dovecot-1.2
changeset 3456:5ec00b12f4db HEAD
Don't store headers into cache file if they are already there.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 03 Jul 2005 13:47:38 +0300 |
parents | e04d4a496a0b |
children | b5885ba96ec8 |
files | src/lib-storage/index/index-mail-headers.c |
diffstat | 1 files changed, 13 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/index-mail-headers.c Sun Jul 03 13:37:07 2005 +0300 +++ b/src/lib-storage/index/index-mail-headers.c Sun Jul 03 13:47:38 2005 +0300 @@ -66,7 +66,10 @@ just want to ignore it. */ i_assert(match[match_idx] != mail->header_match_value + 1); - if (match[match_idx] == mail->header_match_value) { + if (match[match_idx] == mail->header_match_value && + mail_cache_field_exists(mail->trans->cache_view, + mail->data.seq, + match_idx) == 0) { /* this header doesn't exist. remember that. */ mail_cache_add(mail->trans->cache_trans, mail->data.seq, match_idx, @@ -82,6 +85,11 @@ match_idx++; } + if (!lines[i].cache) { + /* header is already cached */ + continue; + } + /* buffer contains: { uint32_t line_num[], 0, header texts } noncontiguous is just a small optimization.. */ buffer_set_used_size(buf, 0); @@ -118,7 +126,9 @@ } for (; match_idx < match_count; match_idx++) { - if (match[match_idx] == mail->header_match_value) { + if (match[match_idx] == mail->header_match_value && + mail_cache_field_exists(mail->trans->cache_view, + mail->data.seq, match_idx) == 0) { /* this header doesn't exist. remember that. */ mail_cache_add(mail->trans->cache_trans, mail->data.seq, match_idx, NULL, 0); @@ -151,7 +161,7 @@ mail->header_match_value += 2; if (mail->header_match_value == 0) { - /* @UNSAFE: wrapped, we'll have to clear the buffer */ + /* wrapped, we'll have to clear the buffer */ array_clear(&mail->header_match); mail->header_match_value = 2; }