[dovecot-cvs] dovecot/src/lib-storage mail-search.c, 1.20, 1.21 mail-search.h, 1.13, 1.14 mailbox-list.c, 1.4, 1.5 mailbox-list.h, 1.3, 1.4

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


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

Modified Files:
	mail-search.c mail-search.h mailbox-list.c mailbox-list.h 
Log Message:
Added context parameter type safety checks for most callback APIs.



Index: mail-search.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-search.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- mail-search.c	20 Jun 2006 15:16:34 -0000	1.20
+++ mail-search.c	15 Dec 2006 16:55:43 -0000	1.21
@@ -26,7 +26,7 @@
 }
 
 static void search_arg_foreach(struct mail_search_arg *arg,
-			       mail_search_foreach_callback_t callback,
+			       mail_search_foreach_callback_t *callback,
 			       void *context)
 {
 	struct mail_search_arg *subarg;
@@ -84,8 +84,9 @@
 	}
 }
 
+#undef mail_search_args_foreach
 int mail_search_args_foreach(struct mail_search_arg *args,
-			     mail_search_foreach_callback_t callback,
+			     mail_search_foreach_callback_t *callback,
 			     void *context)
 {
 	int result;

Index: mail-search.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-search.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- mail-search.h	13 Jan 2006 20:26:24 -0000	1.13
+++ mail-search.h	15 Dec 2006 16:55:43 -0000	1.14
@@ -68,8 +68,8 @@
 			(res) == -1 ? -1 : !(res); \
 	} STMT_END
 
-typedef void (*mail_search_foreach_callback_t)(struct mail_search_arg *arg,
-					       void *context);
+typedef void mail_search_foreach_callback_t(struct mail_search_arg *arg,
+					    void *context);
 
 /* Reset the results in search arguments. match_always is reset only if
    full_reset is TRUE. */
@@ -78,8 +78,12 @@
 /* goes through arguments in list that don't have a result yet.
    Returns 1 = search matched, 0 = search unmatched, -1 = don't know yet */
 int mail_search_args_foreach(struct mail_search_arg *args,
-			     mail_search_foreach_callback_t callback,
+			     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)
 
 /* 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.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- mailbox-list.c	6 Dec 2006 15:08:24 -0000	1.4
+++ mailbox-list.c	15 Dec 2006 16:55:43 -0000	1.5
@@ -72,6 +72,7 @@
 		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.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- mailbox-list.h	6 Dec 2006 15:08:24 -0000	1.3
+++ mailbox-list.h	15 Dec 2006 16:55:43 -0000	1.4
@@ -110,6 +110,14 @@
 		      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