From cf06571a8b7f665ec464ae1c0455b51bf989c43b Mon Sep 17 00:00:00 2001
From: Guido van Rossum <guido@python.org>
Date: Thu, 21 Sep 2000 14:32:04 +0000
Subject: Use PyOS_setsig() instead of signal().  Also remove redundant spaces
 from the FreeBSD code.

---
 Modules/fpectlmodule.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/Modules/fpectlmodule.c b/Modules/fpectlmodule.c
index 59d2b72..8034489 100644
--- a/Modules/fpectlmodule.c
+++ b/Modules/fpectlmodule.c
@@ -130,7 +130,7 @@ static void fpe_reset(Sigfunc *handler)
 		 (user_routine *)0,
 		 _ABORT_ON_ERROR,
 		 NULL);
-    signal(SIGFPE, handler);
+    PyOS_setsig(SIGFPE, handler);
 
 /*-- SunOS and Solaris ----------------------------------------------------*/
 #elif defined(sun)
@@ -144,7 +144,7 @@ static void fpe_reset(Sigfunc *handler)
     (void) nonstandard_arithmetic();
     (void) ieee_flags("clearall",mode,in,&out);
     (void) ieee_handler("set","common",(sigfpe_handler_type)handler);
-    signal(SIGFPE, handler);
+    PyOS_setsig(SIGFPE, handler);
 
 /*-- HPUX -----------------------------------------------------------------*/
 #elif defined(__hppa) || defined(hppa)
@@ -153,7 +153,7 @@ static void fpe_reset(Sigfunc *handler)
     /* ld -b -o fpectlmodule.sl fpectlmodule.o -lm */
 #include <math.h>
     fpsetdefaults();
-    signal(SIGFPE, handler);
+    PyOS_setsig(SIGFPE, handler);
 
 /*-- IBM AIX --------------------------------------------------------------*/
 #elif defined(__AIX) || defined(_AIX)
@@ -161,7 +161,7 @@ static void fpe_reset(Sigfunc *handler)
 #include <fptrap.h>
     fp_trap(FP_TRAP_SYNC);
     fp_enable(TRP_INVALID | TRP_DIV_BY_ZERO | TRP_OVERFLOW);
-    signal(SIGFPE, handler);
+    PyOS_setsig(SIGFPE, handler);
 
 /*-- DEC ALPHA OSF --------------------------------------------------------*/
 #elif defined(__alpha) && defined(__osf__)
@@ -172,7 +172,7 @@ static void fpe_reset(Sigfunc *handler)
     unsigned long fp_control =
     IEEE_TRAP_ENABLE_INV | IEEE_TRAP_ENABLE_DZE | IEEE_TRAP_ENABLE_OVF;
     ieee_set_fp_control(fp_control);
-    signal(SIGFPE, handler);
+    PyOS_setsig(SIGFPE, handler);
 
 /*-- Cray Unicos ----------------------------------------------------------*/
 #elif defined(cray)
@@ -180,13 +180,13 @@ static void fpe_reset(Sigfunc *handler)
 #ifdef HAS_LIBMSET
     libmset(-1);
 #endif
-    signal(SIGFPE, handler);
+    PyOS_setsig(SIGFPE, handler);
 
 /*-- FreeBSD ----------------------------------------------------------------*/
 #elif defined(__FreeBSD__)
-    fpresetsticky( fpgetsticky() );
-    fpsetmask( FP_X_INV | FP_X_DZ | FP_X_OFL );
-    signal( SIGFPE, handler );
+    fpresetsticky(fpgetsticky());
+    fpsetmask(FP_X_INV | FP_X_DZ | FP_X_OFL);
+    PyOS_setsig(SIGFPE, handler);
 
 /*-- Linux ----------------------------------------------------------------*/
 #elif defined(linux)
@@ -196,13 +196,13 @@ static void fpe_reset(Sigfunc *handler)
 #include <i386/fpu_control.h>
 #endif
     __setfpucw(0x1372);
-    signal(SIGFPE, handler);
+    PyOS_setsig(SIGFPE, handler);
 
 /*-- NeXT -----------------------------------------------------------------*/
 #elif defined(NeXT) && defined(m68k) && defined(__GNUC__)
     /* NeXT needs explicit csr set to generate SIGFPE */
     asm("fmovel     #0x1400,fpcr");   /* set OVFL and ZD bits */
-    signal(SIGFPE, handler);
+    PyOS_setsig(SIGFPE, handler);
 
 /*-- Microsoft Windows, NT ------------------------------------------------*/
 #elif defined(_MSC_VER)
@@ -211,7 +211,7 @@ static void fpe_reset(Sigfunc *handler)
 #include <float.h>
     unsigned int cw = _EM_INVALID | _EM_ZERODIVIDE | _EM_OVERFLOW;
     (void)_controlfp(0, cw);
-    signal(SIGFPE, handler);
+    PyOS_setsig(SIGFPE, handler);
 
 /*-- Give Up --------------------------------------------------------------*/
 #else
@@ -223,12 +223,12 @@ static void fpe_reset(Sigfunc *handler)
 static PyObject *turnoff_sigfpe(PyObject *self,PyObject *args)
 {
 #ifdef __FreeBSD__
-    fpresetsticky( fpgetsticky() );
-    fpsetmask( 0 );
+    fpresetsticky(fpgetsticky());
+    fpsetmask(0);
 #else
     fputs("Operation not implemented\n", stderr);
 #endif
-    Py_INCREF (Py_None);
+    Py_INCREF(Py_None);
     return Py_None;
 }
 
-- 
cgit v0.12

