[dovecot-cvs] dovecot/src/login-common login-proxy.h,1.4,1.5

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


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

Modified Files:
	login-proxy.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: login-proxy.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/login-common/login-proxy.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- login-proxy.h	15 Dec 2006 16:55:48 -0000	1.4
+++ login-proxy.h	15 Dec 2006 18:11:07 -0000	1.5
@@ -12,9 +12,17 @@
 struct login_proxy *
 login_proxy_new(struct client *client, const char *host, unsigned int port,
 		proxy_callback_t *callback, void *context);
-#define login_proxy_new(client, host, port, callback, context) \
-	CONTEXT_CALLBACK3(login_proxy_new, proxy_callback_t, \
-			  callback, context, client, host, port)
+#ifdef CONTEXT_TYPE_SAFETY
+#  define login_proxy_new(client, host, port, callback, context) \
+	({(void)(1 ? 0 : callback((struct istream *)NULL, \
+				  (struct ostream *)NULL, context)); \
+	  login_proxy_new(client, host, port, \
+		(proxy_callback_t *)callback, context); })
+#else
+#  define login_proxy_new(client, host, port, callback, context) \
+	  login_proxy_new(client, host, port, \
+		(proxy_callback_t *)callback, context)
+#endif
 /* Free the proxy. This should be called if authentication fails. */
 void login_proxy_free(struct login_proxy *proxy);
 



More information about the dovecot-cvs mailing list