[dovecot-cvs] dovecot/src/lib-index mail-cache-lookup.c, 1.36, 1.37 mail-cache-private.h, 1.35, 1.36 mail-hash.h, 1.12, 1.13 mail-index-private.h, 1.76, 1.77 mail-index.c, 1.247, 1.248

tss at dovecot.org tss at dovecot.org
Fri Dec 15 18:10:59 UTC 2006


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

Modified Files:
	mail-cache-lookup.c mail-cache-private.h mail-hash.h 
	mail-index-private.h mail-index.c 
Log Message:
Type safe callbacks weren't as easy as I thought. Only callback(void
*context) can be handled generically. Others can be handled specially, but
only if all the parameters are pointers, otherwise eg. int parameter can be
replaced with long without compiler giving any warnings.



Index: mail-cache-lookup.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-cache-lookup.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- mail-cache-lookup.c	15 Dec 2006 16:55:40 -0000	1.36
+++ mail-cache-lookup.c	15 Dec 2006 18:10:54 -0000	1.37
@@ -179,7 +179,6 @@
 	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.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- mail-cache-private.h	15 Dec 2006 16:55:40 -0000	1.35
+++ mail-cache-private.h	15 Dec 2006 18:10:54 -0000	1.36
@@ -199,10 +199,6 @@
 
 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-hash.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-hash.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- mail-hash.h	15 Dec 2006 16:55:40 -0000	1.12
+++ mail-hash.h	15 Dec 2006 18:10:55 -0000	1.13
@@ -71,12 +71,21 @@
 	       hash_callback_t *rec_hash_cb,
 	       hash_ctx_cmp_callback_t *key_compare_cb,
 	       void *context);
+#ifdef CONTEXT_TYPE_SAFETY
 #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)(1 ? 0 : key_compare_cb((const void *)NULL, \
+					(const void *)NULL, context)); \
+	  mail_hash_open(index, suffix, flags, record_size, initial_count, \
+		key_hash_cb, rec_hash_cb, \
+		(hash_ctx_cmp_callback_t *)key_compare_cb, context); })
+#else
+#define mail_hash_open(index, suffix, flags, record_size, initial_count, \
+		       key_hash_cb, rec_hash_cb, key_compare_cb, context) \
+	  mail_hash_open(index, suffix, flags, record_size, initial_count, \
+		key_hash_cb, rec_hash_cb, \
+		(hash_ctx_cmp_callback_t *)key_compare_cb, context)
+#endif
 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.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- mail-index-private.h	15 Dec 2006 16:55:40 -0000	1.76
+++ mail-index-private.h	15 Dec 2006 18:10:55 -0000	1.77
@@ -193,11 +193,6 @@
 					 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.247
retrieving revision 1.248
diff -u -d -r1.247 -r1.248
--- mail-index.c	15 Dec 2006 16:55:40 -0000	1.247
+++ mail-index.c	15 Dec 2006 18:10:56 -0000	1.248
@@ -108,7 +108,6 @@
 	return ext_count;
 }
 
-#undef mail_index_register_expunge_handler
 void mail_index_register_expunge_handler(struct mail_index *index,
 					 uint32_t ext_id, bool call_always,
 					 mail_index_expunge_handler_t *cb,



More information about the dovecot-cvs mailing list