From 0796b0027965b1ea4f7b1775ad2e883d66f07d89 Mon Sep 17 00:00:00 2001 From: Thomas Wouters Date: Sat, 22 Jul 2000 23:49:30 +0000 Subject: [PATCH] Further ANSIfication of functionpointers and declarations. Also, make sure to return something if RETSIGTYPE isn't void, in functions that are defined to return RETSIGTYPE. Work around an argumentlist mismatch ('void' vs. 'void *') by using a static wrapper function. --- Modules/signalmodule.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index 757fe787af6..3a2a6dfeb78 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -26,7 +26,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. #include #ifndef SIG_ERR -#define SIG_ERR ((RETSIGTYPE (*)())-1) +#define SIG_ERR ((RETSIGTYPE (*)(int))-1) #endif #if defined(PYOS_OS2) @@ -92,7 +92,7 @@ static PyObject *DefaultHandler; static PyObject *IgnoreHandler; static PyObject *IntHandler; -static RETSIGTYPE (*old_siginthandler)() = SIG_DFL; +static RETSIGTYPE (*old_siginthandler)(int) = SIG_DFL; @@ -110,6 +110,13 @@ The default handler for SIGINT instated by Python.\n\ It raises KeyboardInterrupt."; + +static int +checksignals_witharg(void * unused) +{ + return PyErr_CheckSignals(); +} + static RETSIGTYPE signal_handler(int sig_num) { @@ -119,8 +126,7 @@ signal_handler(int sig_num) #endif is_tripped++; Handlers[sig_num].tripped = 1; - Py_AddPendingCall( - (int (*)(ANY *))PyErr_CheckSignals, NULL); + Py_AddPendingCall(checksignals_witharg, NULL); #ifdef WITH_THREAD } #endif @@ -136,7 +142,10 @@ signal_handler(int sig_num) #ifdef HAVE_SIGINTERRUPT siginterrupt(sig_num, 1); #endif - (void)signal(sig_num, &signal_handler); + signal(sig_num, signal_handler); +#if RETSIGTYPE != void + return 0; +#endif } @@ -191,7 +200,7 @@ signal_signal(PyObject *self, PyObject *args) PyObject *obj; int sig_num; PyObject *old_handler; - RETSIGTYPE (*func)(); + RETSIGTYPE (*func)(int); if (!PyArg_Parse(args, "(iO)", &sig_num, &obj)) return NULL; #ifdef WITH_THREAD @@ -348,7 +357,7 @@ initsignal(void) Handlers[0].tripped = 0; for (i = 1; i < NSIG; i++) { - RETSIGTYPE (*t)(); + RETSIGTYPE (*t)(int); #ifdef HAVE_SIGACTION struct sigaction act; sigaction(i, 0, &act);