[dovecot-cvs] dovecot/src/lib-index mail-cache-compress.c, 1.27, 1.28 mail-cache-decisions.c, 1.8, 1.9 mail-index-transaction-view.c, 1.8, 1.9 mail-index-view-private.h, 1.14, 1.15 mail-index-view.c, 1.28, 1.29 mail-index.h, 1.135, 1.136

cras at dovecot.org cras at dovecot.org
Wed Nov 24 20:40:00 EET 2004


Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv7756/lib-index

Modified Files:
	mail-cache-compress.c mail-cache-decisions.c 
	mail-index-transaction-view.c mail-index-view-private.h 
	mail-index-view.c mail-index.h 
Log Message:
Changed mail_index_get_header() to return the header as return value because
it can't fail anymore.



Index: mail-cache-compress.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-cache-compress.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- mail-cache-compress.c	11 Nov 2004 22:24:08 -0000	1.27
+++ mail-cache-compress.c	24 Nov 2004 18:39:57 -0000	1.28
@@ -124,8 +124,7 @@
 
 	/* get sequence of first message which doesn't need it's temp fields
 	   removed. */
-	if (mail_index_get_header(view, &idx_hdr) < 0)
-		return -1;
+	idx_hdr = mail_index_get_header(view);
 	if (idx_hdr->day_first_uid[7] == 0) {
 		first_new_seq = 1;
 		message_count = mail_index_view_get_message_count(view);

Index: mail-cache-decisions.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-cache-decisions.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- mail-cache-decisions.c	7 Nov 2004 20:35:26 -0000	1.8
+++ mail-cache-decisions.c	24 Nov 2004 18:39:57 -0000	1.9
@@ -87,9 +87,9 @@
 	}
 
 	/* see if we want to change decision from TEMP to YES */
-	if (mail_index_lookup_uid(view->view, seq, &uid) < 0 ||
-	    mail_index_get_header(view->view, &hdr) < 0)
+	if (mail_index_lookup_uid(view->view, seq, &uid) < 0)
 		return;
+	hdr = mail_index_get_header(view->view);
 
 	if (ioloop_time - cache->fields[field].last_used > 3600*24) {
 		/* update last_used about once a day */

Index: mail-index-transaction-view.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-transaction-view.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- mail-index-transaction-view.c	13 Nov 2004 23:08:07 -0000	1.8
+++ mail-index-transaction-view.c	24 Nov 2004 18:39:57 -0000	1.9
@@ -31,17 +31,14 @@
 		 tview->t->last_new_seq - tview->t->first_new_seq);
 }
 
-static int _tview_get_header(struct mail_index_view *view,
-			     const struct mail_index_header **hdr_r)
+static const struct mail_index_header *
+_tview_get_header(struct mail_index_view *view)
 {
 	struct mail_index_view_transaction *tview =
                 (struct mail_index_view_transaction *)view;
 
-	if (tview->parent->get_header(view, hdr_r) < 0)
-		return -1;
-
 	/* FIXME: header counters may not be correct */
-	return 0;
+	return tview->parent->get_header(view);
 }
 
 static int _tview_lookup_full(struct mail_index_view *view, uint32_t seq,

Index: mail-index-view-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-view-private.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- mail-index-view-private.h	13 Nov 2004 23:08:07 -0000	1.14
+++ mail-index-view-private.h	24 Nov 2004 18:39:57 -0000	1.15
@@ -6,8 +6,8 @@
 struct mail_index_view_methods {
 	void (*close)(struct mail_index_view *view);
 	uint32_t (*get_message_count)(struct mail_index_view *view);
-	int (*get_header)(struct mail_index_view *view,
-			  const struct mail_index_header **hdr_r);
+	const struct mail_index_header *
+		(*get_header)(struct mail_index_view *view);
 	int (*lookup_full)(struct mail_index_view *view, uint32_t seq,
 			   struct mail_index_map **map_r,
 			   const struct mail_index_record **rec_r);

Index: mail-index-view.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-view.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- mail-index-view.c	13 Nov 2004 23:08:07 -0000	1.28
+++ mail-index-view.c	24 Nov 2004 18:39:57 -0000	1.29
@@ -164,11 +164,10 @@
 	return view->messages_count;
 }
 
-static int _view_get_header(struct mail_index_view *view,
-			    const struct mail_index_header **hdr_r)
+static const struct mail_index_header *
+_view_get_header(struct mail_index_view *view)
 {
-	*hdr_r = &view->hdr;
-	return 0;
+	return &view->hdr;
 }
 
 static int _view_lookup_full(struct mail_index_view *view, uint32_t seq,
@@ -432,10 +431,10 @@
 	return view->messages_count;
 }
 
-int mail_index_get_header(struct mail_index_view *view,
-			  const struct mail_index_header **hdr_r)
+const struct mail_index_header *
+mail_index_get_header(struct mail_index_view *view)
 {
-	return view->methods.get_header(view, hdr_r);
+	return view->methods.get_header(view);
 }
 
 int mail_index_lookup(struct mail_index_view *view, uint32_t seq,

Index: mail-index.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.h,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -d -r1.135 -r1.136
--- mail-index.h	11 Nov 2004 22:01:39 -0000	1.135
+++ mail-index.h	24 Nov 2004 18:39:57 -0000	1.136
@@ -250,8 +250,8 @@
 void mail_index_view_sync_end(struct mail_index_view_sync_ctx *ctx);
 
 /* Returns the index header. */
-int mail_index_get_header(struct mail_index_view *view,
-			  const struct mail_index_header **hdr_r);
+const struct mail_index_header *
+mail_index_get_header(struct mail_index_view *view);
 /* Returns the given message. Returns -1 if error, 1 if ok, 0 if mail was
    expunged but data was returned from some older index.  */
 int mail_index_lookup(struct mail_index_view *view, uint32_t seq,



More information about the dovecot-cvs mailing list