提交 a7dbcf5c 编写于 作者: R Rich Felker

use 0 instead of NULL for null pointer constants

and thereby remove otherwise-unnecessary inclusion of stddef.h
上级 57174444
#include <signal.h> #include <signal.h>
#include <stddef.h>
int sighold(int sig) int sighold(int sig)
{ {
...@@ -7,5 +6,5 @@ int sighold(int sig) ...@@ -7,5 +6,5 @@ int sighold(int sig)
sigemptyset(&mask); sigemptyset(&mask);
if (sigaddset(&mask, sig) < 0) return -1; if (sigaddset(&mask, sig) < 0) return -1;
return sigprocmask(SIG_BLOCK, &mask, NULL); return sigprocmask(SIG_BLOCK, &mask, 0);
} }
#include <signal.h> #include <signal.h>
#include <stddef.h>
int sigignore(int sig) int sigignore(int sig)
{ {
...@@ -8,5 +7,5 @@ int sigignore(int sig) ...@@ -8,5 +7,5 @@ int sigignore(int sig)
sigemptyset(&sa.sa_mask); sigemptyset(&sa.sa_mask);
sa.sa_handler = SIG_IGN; sa.sa_handler = SIG_IGN;
sa.sa_flags = 0; sa.sa_flags = 0;
return sigaction(sig, &sa, NULL); return sigaction(sig, &sa, 0);
} }
#include <stddef.h>
#include <signal.h> #include <signal.h>
int siginterrupt(int sig, int flag) int siginterrupt(int sig, int flag)
{ {
struct sigaction sa; struct sigaction sa;
sigaction(sig, NULL, &sa); sigaction(sig, 0, &sa);
if (flag) sa.sa_flags &= ~SA_RESTART; if (flag) sa.sa_flags &= ~SA_RESTART;
else sa.sa_flags |= SA_RESTART; else sa.sa_flags |= SA_RESTART;
return sigaction(sig, &sa, NULL); return sigaction(sig, &sa, 0);
} }
#include <signal.h> #include <signal.h>
#include <stddef.h>
int sigrelse(int sig) int sigrelse(int sig)
{ {
...@@ -7,5 +6,5 @@ int sigrelse(int sig) ...@@ -7,5 +6,5 @@ int sigrelse(int sig)
sigemptyset(&mask); sigemptyset(&mask);
if (sigaddset(&mask, sig) < 0) return -1; if (sigaddset(&mask, sig) < 0) return -1;
return sigprocmask(SIG_UNBLOCK, &mask, NULL); return sigprocmask(SIG_UNBLOCK, &mask, 0);
} }
#include <signal.h> #include <signal.h>
#include <stddef.h>
void (*sigset(int sig, void (*handler)(int)))(int) void (*sigset(int sig, void (*handler)(int)))(int)
{ {
...@@ -11,7 +10,7 @@ void (*sigset(int sig, void (*handler)(int)))(int) ...@@ -11,7 +10,7 @@ void (*sigset(int sig, void (*handler)(int)))(int)
return SIG_ERR; return SIG_ERR;
if (handler == SIG_HOLD) { if (handler == SIG_HOLD) {
if (sigaction(sig, NULL, &sa_old) < 0) if (sigaction(sig, 0, &sa_old) < 0)
return SIG_ERR; return SIG_ERR;
if (sigprocmask(SIG_BLOCK, &mask, &mask) < 0) if (sigprocmask(SIG_BLOCK, &mask, &mask) < 0)
return SIG_ERR; return SIG_ERR;
......
#include <signal.h> #include <signal.h>
#include <stddef.h>
int sigwait(const sigset_t *restrict mask, int *restrict sig) int sigwait(const sigset_t *restrict mask, int *restrict sig)
{ {
siginfo_t si; siginfo_t si;
if (sigtimedwait(mask, &si, NULL) < 0) if (sigtimedwait(mask, &si, 0) < 0)
return -1; return -1;
*sig = si.si_signo; *sig = si.si_signo;
return 0; return 0;
......
#include <signal.h> #include <signal.h>
#include <stddef.h>
int sigwaitinfo(const sigset_t *restrict mask, siginfo_t *restrict si) int sigwaitinfo(const sigset_t *restrict mask, siginfo_t *restrict si)
{ {
return sigtimedwait(mask, si, NULL); return sigtimedwait(mask, si, 0);
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册