diff options
author | Geoffrey Keating <geoffk@geoffk.org> | 2000-09-19 23:39:45 +0400 |
---|---|---|
committer | Geoffrey Keating <geoffk@geoffk.org> | 2000-09-19 23:39:45 +0400 |
commit | b944c6f661ac5ae1d19f325622111f0ed4760caa (patch) | |
tree | 24fd21634bb1b4136b062f65083e4059246ba27b /newlib/libc | |
parent | b963175618d1d3e5979ea4295d0fee45264e1fbb (diff) |
* 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.
Diffstat (limited to 'newlib/libc')
-rw-r--r-- | newlib/libc/signal/signal.c | 50 |
1 files changed, 20 insertions, 30 deletions
diff --git a/newlib/libc/signal/signal.c b/newlib/libc/signal/signal.c index 56c735372..df005f1b9 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; |