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.
This commit is contained in:
Thomas Wouters 2000-07-22 23:49:30 +00:00
parent b4bd21cf79
commit 0796b00279

View file

@ -26,7 +26,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#include <signal.h> #include <signal.h>
#ifndef SIG_ERR #ifndef SIG_ERR
#define SIG_ERR ((RETSIGTYPE (*)())-1) #define SIG_ERR ((RETSIGTYPE (*)(int))-1)
#endif #endif
#if defined(PYOS_OS2) #if defined(PYOS_OS2)
@ -92,7 +92,7 @@ static PyObject *DefaultHandler;
static PyObject *IgnoreHandler; static PyObject *IgnoreHandler;
static PyObject *IntHandler; 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."; It raises KeyboardInterrupt.";
static int
checksignals_witharg(void * unused)
{
return PyErr_CheckSignals();
}
static RETSIGTYPE static RETSIGTYPE
signal_handler(int sig_num) signal_handler(int sig_num)
{ {
@ -119,8 +126,7 @@ signal_handler(int sig_num)
#endif #endif
is_tripped++; is_tripped++;
Handlers[sig_num].tripped = 1; Handlers[sig_num].tripped = 1;
Py_AddPendingCall( Py_AddPendingCall(checksignals_witharg, NULL);
(int (*)(ANY *))PyErr_CheckSignals, NULL);
#ifdef WITH_THREAD #ifdef WITH_THREAD
} }
#endif #endif
@ -136,7 +142,10 @@ signal_handler(int sig_num)
#ifdef HAVE_SIGINTERRUPT #ifdef HAVE_SIGINTERRUPT
siginterrupt(sig_num, 1); siginterrupt(sig_num, 1);
#endif #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; PyObject *obj;
int sig_num; int sig_num;
PyObject *old_handler; PyObject *old_handler;
RETSIGTYPE (*func)(); RETSIGTYPE (*func)(int);
if (!PyArg_Parse(args, "(iO)", &sig_num, &obj)) if (!PyArg_Parse(args, "(iO)", &sig_num, &obj))
return NULL; return NULL;
#ifdef WITH_THREAD #ifdef WITH_THREAD
@ -348,7 +357,7 @@ initsignal(void)
Handlers[0].tripped = 0; Handlers[0].tripped = 0;
for (i = 1; i < NSIG; i++) { for (i = 1; i < NSIG; i++) {
RETSIGTYPE (*t)(); RETSIGTYPE (*t)(int);
#ifdef HAVE_SIGACTION #ifdef HAVE_SIGACTION
struct sigaction act; struct sigaction act;
sigaction(i, 0, &act); sigaction(i, 0, &act);