[dovecot-cvs] dovecot/src/lib lib-signals.c, 1.15, 1.16 lib-signals.h, 1.8, 1.9 macros.h, 1.20, 1.21

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


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

Modified Files:
	lib-signals.c lib-signals.h macros.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: lib-signals.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/lib-signals.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- lib-signals.c	15 Dec 2006 16:55:32 -0000	1.15
+++ lib-signals.c	15 Dec 2006 18:10:53 -0000	1.16
@@ -99,7 +99,6 @@
 	}
 }
 
-#undef lib_signals_set_handler
 void lib_signals_set_handler(int signo, bool delayed,
 			     signal_handler_t *handler, void *context)
 {
@@ -163,7 +162,6 @@
 		i_fatal("sigaction(%d): %m", signo);
 }
 
-#undef lib_signals_unset_handler
 void lib_signals_unset_handler(int signo, signal_handler_t *handler,
 			       void *context)
 {

Index: lib-signals.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/lib-signals.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- lib-signals.h	15 Dec 2006 16:55:32 -0000	1.8
+++ lib-signals.h	15 Dec 2006 18:10:53 -0000	1.9
@@ -9,16 +9,10 @@
    will be called later, ie. not as a real signal handler. */
 void lib_signals_set_handler(int signo, bool delayed,
 			     signal_handler_t *handler, void *context);
-#define lib_signals_set_handler(signo, delayed, handler, context) \
-	CONTEXT_CALLBACK2(lib_signals_set_handler, signal_handler_t, \
-			  handler, context, signo, delayed)
 /* Ignore given signal. */
 void lib_signals_ignore(int signo, bool restart_syscalls);
 void lib_signals_unset_handler(int signo,
 			       signal_handler_t *handler, void *context);
-#define lib_signals_unset_handler(signo, handler, context) \
-	CONTEXT_CALLBACK2(lib_signals_unset_handler, signal_handler_t, \
-			  handler, context, signo)
 
 void lib_signals_init(void);
 void lib_signals_deinit(void);

Index: macros.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/macros.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- macros.h	15 Dec 2006 16:55:32 -0000	1.20
+++ macros.h	15 Dec 2006 18:10:53 -0000	1.21
@@ -136,25 +136,9 @@
 #  define CONTEXT_CALLBACK(name, callback_type, callback, context, ...) \
 	({(void)(1 ? 0 : callback(context)); \
 	name(__VA_ARGS__, (callback_type *)callback, context); })
-#  define CONTEXT_CALLBACK2(name, callback_type, callback, context, ...) \
-	({(void)(1 ? 0 : callback(0, context)); \
-	name(__VA_ARGS__, (callback_type *)callback, context); })
-#  define CONTEXT_CALLBACK3(name, callback_type, callback, context, ...) \
-	({(void)(1 ? 0 : callback(0, 0, context)); \
-	name(__VA_ARGS__, (callback_type *)callback, context); })
-#  define CONTEXT_CALLBACK4(name, callback_type, callback, context, ...) \
-	({(void)(1 ? 0 : callback(0, 0, 0, context)); \
-	name(__VA_ARGS__, (callback_type *)callback, context); })
-#  define CONTEXT_CALLBACK5(name, callback_type, callback, context, ...) \
-	({(void)(1 ? 0 : callback(0, 0, 0, 0, context)); \
-	name(__VA_ARGS__, (callback_type *)callback, context); })
 #else
 #  define CONTEXT_CALLBACK(name, callback_type, callback, context, ...) \
 	name(__VA_ARGS__, (callback_type *)callback, context)
-#  define CONTEXT_CALLBACK2 CONTEXT_CALLBACK
-#  define CONTEXT_CALLBACK3 CONTEXT_CALLBACK
-#  define CONTEXT_CALLBACK4 CONTEXT_CALLBACK
-#  define CONTEXT_CALLBACK5 CONTEXT_CALLBACK
 #endif
 
 /* Wrap the gcc __PRETTY_FUNCTION__ and __FUNCTION__ variables with



More information about the dovecot-cvs mailing list