зеркало из https://github.com/github/ruby.git
signal.c: if to switch
* signal.c (ruby_signal): turn multiple `if` statements into a `switch`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
058b5bce60
Коммит
b60fbca806
14
signal.c
14
signal.c
|
@ -532,18 +532,22 @@ ruby_signal(int signum, sighandler_t handler)
|
|||
sigact.sa_flags = 0;
|
||||
#endif
|
||||
|
||||
switch (signum) {
|
||||
#ifdef SA_NOCLDWAIT
|
||||
if (signum == SIGCHLD && handler == SIG_IGN)
|
||||
sigact.sa_flags |= SA_NOCLDWAIT;
|
||||
case SIGCHLD:
|
||||
if (handler == SIG_IGN)
|
||||
sigact.sa_flags |= SA_NOCLDWAIT;
|
||||
break;
|
||||
#endif
|
||||
#if defined(SA_ONSTACK) && defined(USE_SIGALTSTACK)
|
||||
if (signum == SIGSEGV
|
||||
case SIGSEGV:
|
||||
#ifdef SIGBUS
|
||||
|| signum == SIGBUS
|
||||
case SIGBUS:
|
||||
#endif
|
||||
)
|
||||
sigact.sa_flags |= SA_ONSTACK;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
(void)VALGRIND_MAKE_MEM_DEFINED(&old, sizeof(old));
|
||||
if (sigaction(signum, &sigact, &old) < 0) {
|
||||
if (errno != 0 && errno != EINVAL) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче