[dovecot-cvs] dovecot/src/lib-storage mail-storage-private.h, 1.47, 1.48 mail-storage.c, 1.74, 1.75

tss at dovecot.org tss at dovecot.org
Fri Mar 30 17:12:50 EEST 2007


Update of /var/lib/cvs/dovecot/src/lib-storage
In directory talvi:/tmp/cvs-serv21144/lib-storage

Modified Files:
	mail-storage-private.h mail-storage.c 
Log Message:
Moved all storage destruction code to mail-storage.c and made destroy()
optional. Removed set_callbacks(). Made autodetect() optional.



Index: mail-storage-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-storage-private.h,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- mail-storage-private.h	30 Mar 2007 13:40:12 -0000	1.47
+++ mail-storage-private.h	30 Mar 2007 14:12:48 -0000	1.48
@@ -29,10 +29,6 @@
 
 	bool (*autodetect)(const char *data, enum mail_storage_flags flags);
 
-	void (*set_callbacks)(struct mail_storage *storage,
-			      struct mail_storage_callbacks *callbacks,
-			      void *context);
-
 	struct mailbox *(*mailbox_open)(struct mail_storage *storage,
 					const char *name,
 					struct istream *input,

Index: mail-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-storage.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -d -r1.74 -r1.75
--- mail-storage.c	30 Mar 2007 13:40:12 -0000	1.74
+++ mail-storage.c	30 Mar 2007 14:12:48 -0000	1.75
@@ -7,6 +7,7 @@
 #include "mail-index-private.h"
 #include "mailbox-list-private.h"
 #include "mail-storage-private.h"
+#include "index/index-storage.h"
 
 #include <stdlib.h>
 #include <time.h>
@@ -122,7 +123,8 @@
 
 	classes = array_get(&storages, &count);
 	for (i = 0; i < count; i++) {
-		if (classes[i]->v.autodetect(data, flags))
+		if (classes[i]->v.autodetect != NULL &&
+		    classes[i]->v.autodetect(data, flags))
 			return classes[i];
 	}
 	return NULL;
@@ -214,7 +216,15 @@
 	i_assert(storage != NULL);
 
 	*_storage = NULL;
-	storage->v.destroy(storage);
+
+	if (storage->v.destroy != NULL)
+		storage->v.destroy(storage);
+
+	mailbox_list_deinit(storage->list);
+	i_free(storage->error);
+	pool_unref(storage->pool);
+
+	index_storage_destroy_unrefed();
 }
 
 void mail_storage_clear_error(struct mail_storage *storage)
@@ -313,7 +323,8 @@
 				struct mail_storage_callbacks *callbacks,
 				void *context)
 {
-	storage->v.set_callbacks(storage, callbacks, context);
+	*storage->callbacks = *callbacks;
+	storage->callback_context = context;
 }
 
 int mail_storage_mailbox_create(struct mail_storage *storage, const char *name,



More information about the dovecot-cvs mailing list