[dovecot-cvs] dovecot/src/plugins/fts-lucene Makefile.am, 1.2, 1.3 fts-backend-lucene.c, 1.10, 1.11 fts-lucene-plugin.c, 1.3, 1.4 fts-lucene-plugin.h, 1.2, 1.3

tss at dovecot.org tss at dovecot.org
Thu Mar 29 14:51:13 EEST 2007


Update of /var/lib/cvs/dovecot/src/plugins/fts-lucene
In directory talvi:/tmp/cvs-serv16171/plugins/fts-lucene

Modified Files:
	Makefile.am fts-backend-lucene.c fts-lucene-plugin.c 
	fts-lucene-plugin.h 
Log Message:
Better type safety to module_contexts arrays. Already fixed some bugs.



Index: Makefile.am
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/fts-lucene/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Makefile.am	15 Dec 2006 23:46:24 -0000	1.2
+++ Makefile.am	29 Mar 2007 11:51:10 -0000	1.3
@@ -1,6 +1,7 @@
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/src/lib \
 	-I$(top_srcdir)/src/lib-mail \
+	-I$(top_srcdir)/src/lib-index \
 	-I$(top_srcdir)/src/lib-storage \
 	-I$(top_srcdir)/src/plugins/fts \
 	-I/usr/lib

Index: fts-backend-lucene.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/fts-lucene/fts-backend-lucene.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- fts-backend-lucene.c	25 Mar 2007 16:21:09 -0000	1.10
+++ fts-backend-lucene.c	29 Mar 2007 11:51:10 -0000	1.11
@@ -11,6 +11,7 @@
 #define LUCENE_LOCK_SUBDIR_NAME "locks"
 
 struct lucene_mail_storage {
+	union mail_storage_module_context module_ctx;
 	struct lucene_index *index;
 	struct mailbox *selected_box;
 	int refcount;
@@ -57,8 +58,8 @@
 
 		lstorage = i_new(struct lucene_mail_storage, 1);
 		lstorage->index = lucene_index_init(path, lock_path);
-		array_idx_set(&box->storage->module_contexts,
-			      fts_lucene_storage_module_id, &lstorage);
+		MODULE_CONTEXT_SET(box->storage, fts_lucene_storage_module,
+				   lstorage);
 	}
 	lstorage->refcount++;
 
@@ -75,8 +76,8 @@
 		(struct lucene_fts_backend *)_backend;
 
 	if (--backend->lstorage->refcount == 0) {
-		array_idx_clear(&backend->box->storage->module_contexts,
-				fts_lucene_storage_module_id);
+		MODULE_CONTEXT_UNSET(backend->box->storage,
+				     fts_lucene_storage_module);
 		lucene_index_deinit(backend->lstorage->index);
 		i_free(backend->lstorage);
 	}

Index: fts-lucene-plugin.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/fts-lucene/fts-lucene-plugin.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- fts-lucene-plugin.c	22 Feb 2007 14:27:36 -0000	1.3
+++ fts-lucene-plugin.c	29 Mar 2007 11:51:10 -0000	1.4
@@ -10,7 +10,6 @@
 
 void fts_lucene_plugin_init(void)
 {
-	fts_lucene_storage_module_id = mail_storage_module_id++;
 	fts_backend_register(&fts_backend_lucene);
 }
 

Index: fts-lucene-plugin.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/fts-lucene/fts-lucene-plugin.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- fts-lucene-plugin.h	24 Oct 2006 23:49:13 -0000	1.2
+++ fts-lucene-plugin.h	29 Mar 2007 11:51:10 -0000	1.3
@@ -4,11 +4,11 @@
 #include "fts-api-private.h"
 
 #define LUCENE_CONTEXT(obj) \
-	*((void **)array_idx_modifiable(&(obj)->module_contexts, \
-					fts_lucene_storage_module_id))
+	MODULE_CONTEXT(obj, fts_lucene_storage_module)
 
 extern struct fts_backend fts_backend_lucene;
-extern unsigned int fts_lucene_storage_module_id;
+extern MODULE_CONTEXT_DEFINE(fts_lucene_storage_module,
+			     &mail_storage_module_register);
 
 void fts_lucene_plugin_init(void);
 void fts_lucene_plugin_deinit(void);



More information about the dovecot-cvs mailing list