[dovecot-cvs] dovecot/src/lib-storage mail-search.h, 1.14, 1.15 mailbox-list.c, 1.5, 1.6 mailbox-list.h, 1.4, 1.5

tss at dovecot.org tss at dovecot.org
Fri Dec 15 18:11:04 UTC 2006


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

Modified Files:
	mail-search.h mailbox-list.c mailbox-list.h 
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-search.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-search.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- mail-search.h	15 Dec 2006 16:55:43 -0000	1.14
+++ mail-search.h	15 Dec 2006 18:11:02 -0000	1.15
@@ -80,10 +80,16 @@
 int mail_search_args_foreach(struct mail_search_arg *args,
 			     mail_search_foreach_callback_t *callback,
 			     void *context);
-#define mail_search_args_foreach(args, callback, context) \
-	CONTEXT_CALLBACK2(mail_search_args_foreach, \
-			  mail_search_foreach_callback_t, \
-			  callback, context, args)
+#ifdef CONTEXT_TYPE_SAFETY
+#  define mail_search_args_foreach(args, callback, context) \
+	({(void)(1 ? 0 : callback((struct mail_search_arg *)NULL, context)); \
+	  mail_search_args_foreach(args, \
+		(mail_search_foreach_callback_t *)callback, context); })
+#else
+#  define mail_search_args_foreach(args, callback, context) \
+	  mail_search_args_foreach(args, \
+		(mail_search_foreach_callback_t *)callback, context)
+#endif
 
 /* Fills have_headers and have_body based on if such search argument exists
    that needs to be checked. Returns the headers that we're searching for, or

Index: mailbox-list.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mailbox-list.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- mailbox-list.c	15 Dec 2006 16:55:43 -0000	1.5
+++ mailbox-list.c	15 Dec 2006 18:11:02 -0000	1.6
@@ -72,7 +72,6 @@
 		array_free(&mailbox_list_drivers);
 }
 
-#undef mailbox_list_init
 int mailbox_list_init(const char *driver,
 		      const struct mailbox_list_settings *set,
 		      enum mailbox_list_flags flags,

Index: mailbox-list.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mailbox-list.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- mailbox-list.h	15 Dec 2006 16:55:43 -0000	1.4
+++ mailbox-list.h	15 Dec 2006 18:11:02 -0000	1.5
@@ -110,14 +110,6 @@
 		      enum mailbox_list_flags flags,
 		      mailbox_list_is_mailbox_t *callback, void *context,
 		      struct mailbox_list **list_r, const char **error_r);
-#ifdef CONTEXT_TYPE_SAFETY
-#  define mailbox_list_init(driver, set, flags, callback, context, \
-			    list_r, error_r) \
-	({(void)(1 ? 0 : callback(0, 0, 0, 0, 0, context)); \
-	  mailbox_list_init(driver, set, flags, \
-		(mailbox_list_is_mailbox_t *)callback, context, \
-		list_r, error_r); })
-#endif
 void mailbox_list_deinit(struct mailbox_list *list);
 
 const char *mailbox_list_get_driver_name(struct mailbox_list *list);



More information about the dovecot-cvs mailing list