aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoffrey Keating <geoffk@geoffk.org>2000-09-19 19:39:45 +0000
committerGeoffrey Keating <geoffk@geoffk.org>2000-09-19 19:39:45 +0000
commitb944c6f661ac5ae1d19f325622111f0ed4760caa (patch)
tree24fd21634bb1b4136b062f65083e4059246ba27b
parentb963175618d1d3e5979ea4295d0fee45264e1fbb (diff)
downloadnewlib-b944c6f661ac5ae1d19f325622111f0ed4760caa.zip
newlib-b944c6f661ac5ae1d19f325622111f0ed4760caa.tar.gz
newlib-b944c6f661ac5ae1d19f325622111f0ed4760caa.tar.bz2
* libc/signal/signal.c (__sigtramp_r): ISO C requires
case labels to be integral constant expressions, so use an if/else tree instead. (_raise_r): Likewise.
-rw-r--r--newlib/ChangeLog7
-rw-r--r--newlib/libc/signal/signal.c50
2 files changed, 27 insertions, 30 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index ea51457..55ecc35 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,10 @@
+2000-09-19 Geoffrey Keating <geoffk@cygnus.com>
+
+ * libc/signal/signal.c (__sigtramp_r): ISO C requires
+ case labels to be integral constant expressions, so
+ use an if/else tree instead.
+ (_raise_r): Likewise.
+
2000-09-13 Jeff Johnston <jjohnstn@redhat.com>
* libc/machine/v850/setjmp.S: Fixed tab problems caused by
diff --git a/newlib/libc/signal/signal.c b/newlib/libc/signal/signal.c
index 56c7353..df005f1 100644
--- a/newlib/libc/signal/signal.c
+++ b/newlib/libc/signal/signal.c
@@ -167,7 +167,6 @@ _raise_r (ptr, sig)
int sig;
{
_sig_func_ptr func;
- int result = 0;
if (sig < 0 || sig >= NSIG)
{
@@ -178,27 +177,22 @@ _raise_r (ptr, sig)
if (ptr->_sig_func == NULL && _init_signal_r (ptr) != 0)
return -1;
- switch ((_POINTER_INT) ptr->_sig_func[sig])
+ func = ptr->_sig_func[sig];
+ if (func == SIG_DFL)
+ return _kill_r (ptr, _getpid_r (ptr), sig);
+ else if (func == SIG_IGN)
+ return 0;
+ else if (func == SIG_ERR)
{
- case SIG_DFL:
- return _kill_r (ptr, _getpid_r (ptr), sig);
-
- case SIG_IGN:
- break;
-
- case SIG_ERR:
ptr->_errno = EINVAL;
- result = 1;
- break;
-
- default:
- func = ptr->_sig_func[sig];
+ return 1;
+ }
+ else
+ {
ptr->_sig_func[sig] = SIG_DFL;
func (sig);
- break;
+ return 0;
}
-
- return result;
}
int
@@ -215,20 +209,16 @@ __sigtramp_r (ptr, sig)
if (ptr->_sig_func == NULL && _init_signal_r (ptr) != 0)
return -1;
-
- switch ((_POINTER_INT) ptr->_sig_func[sig])
- {
- case SIG_DFL:
- return 1;
- case SIG_ERR:
- return 2;
-
- case SIG_IGN:
- return 3;
-
- default:
- func = ptr->_sig_func[sig];
+ func = ptr->_sig_func[sig];
+ if (func == SIG_DFL)
+ return 1;
+ else if (func == SIG_ERR)
+ return 2;
+ else if (func == SIG_IGN)
+ return 3;
+ else
+ {
ptr->_sig_func[sig] = SIG_DFL;
func (sig);
return 0;