From 466d7ec9738e4ef41aab40e0179b5036eaf0de4b Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 21 Oct 2003 14:10:05 +0300 Subject: [PATCH] header fix --HG-- branch : HEAD --- src/lib-index/mail-cache.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/lib-index/mail-cache.c b/src/lib-index/mail-cache.c index 4ed4b447f8..282eaff54c 100644 --- a/src/lib-index/mail-cache.c +++ b/src/lib-index/mail-cache.c @@ -787,6 +787,7 @@ int mail_cache_compress(struct mail_cache *cache) /* headers could have changed, reread them */ memset(cache->split_offsets, 0, sizeof(cache->split_offsets)); + memset(cache->split_headers, 0, sizeof(cache->split_headers)); if (ret) { cache->index->header->flags &= @@ -1363,7 +1364,7 @@ int mail_cache_set_header_fields(struct mail_cache_transaction_ctx *ctx, { struct mail_cache *cache = ctx->cache; uint32_t offset, update_offset, size; - const char *header_str; + const char *header_str, *prev_str; i_assert(*headers != NULL); i_assert(idx < MAIL_CACHE_HEADERS_COUNT); @@ -1373,9 +1374,13 @@ int mail_cache_set_header_fields(struct mail_cache_transaction_ctx *ctx, t_push(); header_str = write_header_string(headers, &size); - i_assert(idx == 0 || - strcmp(mail_cache_get_header_fields_str(cache, idx-1), - header_str) != 0); + if (idx != 0) { + prev_str = mail_cache_get_header_fields_str(cache, idx-1); + if (prev_str == NULL) + return FALSE; + + i_assert(strcmp(header_str, prev_str) != 0); + } offset = mail_cache_append_space(ctx, size + sizeof(uint32_t)); if (offset != 0) { -- 2.47.3