summaryrefslogtreecommitdiffstats
path: root/Modules/signalmodule.c
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2000-07-22 23:49:30 (GMT)
committerThomas Wouters <thomas@python.org>2000-07-22 23:49:30 (GMT)
commit0796b0027965b1ea4f7b1775ad2e883d66f07d89 (patch)
treed3c5ed4d80c3ef0646723be811729c1f8b6b9e30 /Modules/signalmodule.c
parentb4bd21cf79166e769b7027d14c2de002ec6ec9cb (diff)
downloadcpython-0796b0027965b1ea4f7b1775ad2e883d66f07d89.zip
cpython-0796b0027965b1ea4f7b1775ad2e883d66f07d89.tar.gz
cpython-0796b0027965b1ea4f7b1775ad2e883d66f07d89.tar.bz2
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.
Diffstat (limited to 'Modules/signalmodule.c')
-rw-r--r--Modules/signalmodule.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index 757fe78..3a2a6df 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 <signal.h>
#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);