[dovecot-cvs] dovecot/src/lib-index mail-cache-lookup.c, 1.35, 1.36 mail-cache-private.h, 1.34, 1.35 mail-cache.c, 1.89, 1.90 mail-hash.c, 1.26, 1.27 mail-hash.h, 1.11, 1.12 mail-index-private.h, 1.75, 1.76 mail-index.c, 1.246, 1.247

tss at dovecot.org tss at dovecot.org
Fri Dec 15 16:55:42 UTC 2006


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

Modified Files:
	mail-cache-lookup.c mail-cache-private.h mail-cache.c 
	mail-hash.c mail-hash.h mail-index-private.h mail-index.c 
Log Message:
Added context parameter type safety checks for most callback APIs.



Index: mail-cache-lookup.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-cache-lookup.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- mail-cache-lookup.c	13 Oct 2006 15:19:54 -0000	1.35
+++ mail-cache-lookup.c	15 Dec 2006 16:55:40 -0000	1.36
@@ -179,6 +179,7 @@
 	return FALSE;
 }
 
+#undef mail_cache_foreach
 int mail_cache_foreach(struct mail_cache_view *view, uint32_t seq,
                        mail_cache_foreach_callback_t *callback, void *context)
 {

Index: mail-cache-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-cache-private.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- mail-cache-private.h	6 Dec 2006 15:08:32 -0000	1.34
+++ mail-cache-private.h	15 Dec 2006 16:55:40 -0000	1.35
@@ -199,6 +199,10 @@
 
 int mail_cache_foreach(struct mail_cache_view *view, uint32_t seq,
 		       mail_cache_foreach_callback_t *callback, void *context);
+#define mail_cache_foreach(view, seq, callback, context) \
+	CONTEXT_CALLBACK5(mail_cache_foreach, \
+			  mail_cache_foreach_callback_t, \
+			  callback, context, view, seq)
 
 int mail_cache_transaction_commit(struct mail_cache_transaction_ctx *ctx);
 void mail_cache_transaction_rollback(struct mail_cache_transaction_ctx *ctx);

Index: mail-cache.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-cache.c,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -d -r1.89 -r1.90
--- mail-cache.c	6 Dec 2006 15:08:32 -0000	1.89
+++ mail-cache.c	15 Dec 2006 16:55:40 -0000	1.90
@@ -315,9 +315,8 @@
 	cache->ext_id =
 		mail_index_ext_register(index, "cache", 0,
 					sizeof(uint32_t), sizeof(uint32_t));
-	mail_index_register_expunge_handler(index, cache->ext_id,
-					    mail_cache_expunge_handler,
-					    cache, FALSE);
+	mail_index_register_expunge_handler(index, cache->ext_id, FALSE,
+					    mail_cache_expunge_handler, cache);
 	mail_index_register_sync_handler(index, cache->ext_id,
 					 mail_cache_sync_handler,
                                          MAIL_INDEX_SYNC_HANDLER_FILE |

Index: mail-hash.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-hash.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- mail-hash.c	6 Dec 2006 15:08:32 -0000	1.26
+++ mail-hash.c	15 Dec 2006 16:55:40 -0000	1.27
@@ -528,6 +528,7 @@
 		i_unreached();
 }
 
+#undef mail_hash_open
 struct mail_hash *
 mail_hash_open(struct mail_index *index, const char *suffix,
 	       enum mail_hash_open_flags flags, unsigned int record_size,

Index: mail-hash.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-hash.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- mail-hash.h	26 Nov 2006 15:20:11 -0000	1.11
+++ mail-hash.h	15 Dec 2006 16:55:40 -0000	1.12
@@ -71,6 +71,12 @@
 	       hash_callback_t *rec_hash_cb,
 	       hash_ctx_cmp_callback_t *key_compare_cb,
 	       void *context);
+#define mail_hash_open(index, suffix, flags, record_size, initial_count, \
+		       key_hash_cb, rec_hash_cb, key_compare_cb, context) \
+	CONTEXT_CALLBACK3(mail_hash_open, \
+			  hash_ctx_cmp_callback_t, \
+			  key_compare_cb, context, index, suffix, flags, \
+			  record_size, initial_count, key_hash_cb, rec_hash_cb)
 void mail_hash_free(struct mail_hash **hash);
 
 /* If reset or resize fails, the hash file is closed and the hash is in

Index: mail-index-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-private.h,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- mail-index-private.h	6 Dec 2006 15:08:32 -0000	1.75
+++ mail-index-private.h	15 Dec 2006 16:55:40 -0000	1.76
@@ -190,9 +190,14 @@
 
 /* Add/replace sync handler for specified extra record. */
 void mail_index_register_expunge_handler(struct mail_index *index,
-					 uint32_t ext_id,
-					 mail_index_expunge_handler_t *cb,
-					 void *context, bool call_always);
+					 uint32_t ext_id, bool call_always,
+					 mail_index_expunge_handler_t *callback,
+					 void *context);
+#define mail_index_register_expunge_handler(index, ext_id, call_always, \
+					    callback, context) \
+	CONTEXT_CALLBACK5(mail_index_register_expunge_handler, \
+			  mail_index_expunge_handler_t, \
+			  callback, context, index, ext_id, call_always)
 void mail_index_unregister_expunge_handler(struct mail_index *index,
 					   uint32_t ext_id);
 void mail_index_register_sync_handler(struct mail_index *index, uint32_t ext_id,

Index: mail-index.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.246
retrieving revision 1.247
diff -u -d -r1.246 -r1.247
--- mail-index.c	6 Dec 2006 15:08:32 -0000	1.246
+++ mail-index.c	15 Dec 2006 16:55:40 -0000	1.247
@@ -108,10 +108,11 @@
 	return ext_count;
 }
 
+#undef mail_index_register_expunge_handler
 void mail_index_register_expunge_handler(struct mail_index *index,
-					 uint32_t ext_id,
+					 uint32_t ext_id, bool call_always,
 					 mail_index_expunge_handler_t *cb,
-					 void *context, bool call_always)
+					 void *context)
 {
 	struct mail_index_registered_ext *rext;
 



More information about the dovecot-cvs mailing list