Mercurial > dovecot > original-hg > dovecot-1.2
diff src/lib-storage/mail-search.h @ 4906:0c3c948412c5 HEAD
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.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 15 Dec 2006 20:10:51 +0200 |
parents | 204d7edc7cdc |
children | b382b21409b5 |
line wrap: on
line diff
--- a/src/lib-storage/mail-search.h Fri Dec 15 19:17:21 2006 +0200 +++ b/src/lib-storage/mail-search.h Fri Dec 15 20:10:51 2006 +0200 @@ -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