]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
a bit memory allocation tweaks
authorTimo Sirainen <tss@iki.fi>
Thu, 10 Apr 2003 20:36:09 +0000 (23:36 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 10 Apr 2003 20:36:09 +0000 (23:36 +0300)
--HG--
branch : HEAD

src/lib-index/maildir/maildir-sync.c

index 12bdd1adec8986cf00132e7ff75c1d7483d41583..07d7b95312220e0aa3693d588d8cd7fbccb933fe 100644 (file)
@@ -300,6 +300,7 @@ static int maildir_index_sync_dir(struct mail_index *index, const char *dir,
        const char *fname;
        void *orig_key, *orig_value;
        unsigned int new_count;
+       size_t size;
        int failed, check_content_changes;
 
        i_assert(dir != NULL);
@@ -312,7 +313,9 @@ static int maildir_index_sync_dir(struct mail_index *index, const char *dir,
        }
 
        /* read current messages in index into hash */
-       pool = pool_alloconly_create("maildir sync", 16384);
+       size = nearest_power(index->header->messages_count *
+                            sizeof(struct maildir_hash_rec) + 1024);
+       pool = pool_alloconly_create("maildir sync", I_MAX(size, 16384));
        files = hash_create(default_pool, pool, index->header->messages_count*2,
                            maildir_hash, maildir_cmp);