changeset 524:a70ca21d022c HEAD

Don't bother going through all that trouble to send file size to ibuffer. One extra fstat() isn't that bad, and we'll soon get rid of the first one..
author Timo Sirainen <tss@iki.fi>
date Sun, 27 Oct 2002 00:11:30 +0300
parents 08a7cdc53876
children 2cb2e0a3423b
files src/lib-index/maildir/maildir-build.c src/lib-index/maildir/maildir-index.h src/lib-index/maildir/maildir-sync.c src/lib-index/maildir/maildir-update.c
diffstat 4 files changed, 7 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/maildir/maildir-build.c	Sat Oct 26 23:35:56 2002 +0300
+++ b/src/lib-index/maildir/maildir-build.c	Sun Oct 27 00:11:30 2002 +0300
@@ -69,8 +69,7 @@
 			    MAILDIR_LOCATION_EXTRA_SPACE);
 
 	/* parse the header and update record's fields */
-	failed = !maildir_record_update(index, update, fd,
-					st.st_size);
+	failed = !maildir_record_update(index, update, fd);
 
 	if (!index->update_end(update) || failed)
 		return FALSE;
--- a/src/lib-index/maildir/maildir-index.h	Sat Oct 26 23:35:56 2002 +0300
+++ b/src/lib-index/maildir/maildir-index.h	Sun Oct 27 00:11:30 2002 +0300
@@ -23,7 +23,6 @@
 IBuffer *maildir_open_mail(MailIndex *index, MailIndexRecord *rec,
 			   int *deleted);
 
-int maildir_record_update(MailIndex *index, MailIndexUpdate *update,
-			  int fd, off_t file_size);
+int maildir_record_update(MailIndex *index, MailIndexUpdate *update, int fd);
 
 #endif
--- a/src/lib-index/maildir/maildir-sync.c	Sat Oct 26 23:35:56 2002 +0300
+++ b/src/lib-index/maildir/maildir-sync.c	Sun Oct 27 00:11:30 2002 +0300
@@ -16,7 +16,7 @@
 
 static int maildir_index_sync_file(MailIndex *index, MailIndexRecord *rec,
 				   unsigned int seq, const char *fname,
-				   const char *path, off_t file_size,
+				   const char *path,
 				   int fname_changed, int file_changed)
 {
 	MailIndexUpdate *update;
@@ -41,7 +41,7 @@
 			index_file_set_syscall_error(index, path, "open()");
 			failed = TRUE;
 		} else {
-			if (!maildir_record_update(index, update, fd, file_size))
+			if (!maildir_record_update(index, update, fd))
 				failed = TRUE;
 			if (close(fd) < 0) {
 				index_file_set_syscall_error(index, path,
@@ -124,8 +124,7 @@
 		fname_changed = strcmp(value, fname) != 0;
 		if (fname_changed || file_changed) {
 			if (!maildir_index_sync_file(index, rec, seq, value,
-						     str, st.st_size,
-						     fname_changed,
+						     str, fname_changed,
 						     file_changed))
 				return FALSE;
 		}
--- a/src/lib-index/maildir/maildir-update.c	Sat Oct 26 23:35:56 2002 +0300
+++ b/src/lib-index/maildir/maildir-update.c	Sun Oct 27 00:11:30 2002 +0300
@@ -4,8 +4,7 @@
 #include "ibuffer.h"
 #include "maildir-index.h"
 
-int maildir_record_update(MailIndex *index, MailIndexUpdate *update,
-			  int fd, off_t file_size)
+int maildir_record_update(MailIndex *index, MailIndexUpdate *update, int fd)
 {
 	IBuffer *inbuf;
         MailField cache_fields;
@@ -18,7 +17,7 @@
 
 	t_push();
 	inbuf = i_buffer_create_mmap(fd, data_stack_pool, MAIL_MMAP_BLOCK_SIZE,
-				     0, file_size, FALSE);
+				     0, 0, FALSE);
 	mail_index_update_headers(update, inbuf, cache_fields, NULL, NULL);
 	i_buffer_unref(inbuf);
 	t_pop();