diff options
author | Alejandro Colomar <alx@kernel.org> | 2024-11-16 16:51:31 +0100 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2024-11-25 16:45:59 -0300 |
commit | 53fcdf5f743aa9b02972eec658e66f96d6a63386 (patch) | |
tree | e1bd3ed90d89027abe4b8ba6f0dbffd833f08a9b /sysdeps/unix/sysv | |
parent | 83d4b42ded712bbbc22ceeefe886b8315190da5b (diff) | |
download | glibc-53fcdf5f743aa9b02972eec658e66f96d6a63386.zip glibc-53fcdf5f743aa9b02972eec658e66f96d6a63386.tar.gz glibc-53fcdf5f743aa9b02972eec658e66f96d6a63386.tar.bz2 |
Silence most -Wzero-as-null-pointer-constant diagnostics
Replace 0 by NULL and {0} by {}.
Omit a few cases that aren't so trivial to fix.
Link: <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117059>
Link: <https://software.codidact.com/posts/292718/292759#answer-292759>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Diffstat (limited to 'sysdeps/unix/sysv')
-rw-r--r-- | sysdeps/unix/sysv/linux/brk.c | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/dl-early_allocate.c | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/dl-sysdep.c | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/gettimeofday.c | 4 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/settimeofday.c | 4 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sigwait.c | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sigwaitinfo.c | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/spawni.c | 8 |
8 files changed, 13 insertions, 13 deletions
diff --git a/sysdeps/unix/sysv/linux/brk.c b/sysdeps/unix/sysv/linux/brk.c index a0be43e..dbdb8dd 100644 --- a/sysdeps/unix/sysv/linux/brk.c +++ b/sysdeps/unix/sysv/linux/brk.c @@ -22,7 +22,7 @@ #include <brk_call.h> /* This must be initialized data because commons can't have aliases. */ -void *__curbrk = 0; +void *__curbrk = NULL; #if HAVE_INTERNAL_BRK_ADDR_SYMBOL /* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt diff --git a/sysdeps/unix/sysv/linux/dl-early_allocate.c b/sysdeps/unix/sysv/linux/dl-early_allocate.c index 4d98076..ce5c6b5 100644 --- a/sysdeps/unix/sysv/linux/dl-early_allocate.c +++ b/sysdeps/unix/sysv/linux/dl-early_allocate.c @@ -51,7 +51,7 @@ _dl_early_allocate (size_t size) { /* If brk has not been invoked, there is no need to update __curbrk. The first call to brk will take care of that. */ - void *previous = __brk_call (0); + void *previous = __brk_call (NULL); result = __brk_call (previous + size); if (result == previous) result = NULL; diff --git a/sysdeps/unix/sysv/linux/dl-sysdep.c b/sysdeps/unix/sysv/linux/dl-sysdep.c index 4352549..d1170a1 100644 --- a/sysdeps/unix/sysv/linux/dl-sysdep.c +++ b/sysdeps/unix/sysv/linux/dl-sysdep.c @@ -113,7 +113,7 @@ _dl_sysdep_start (void **start_argptr, /* Initialize DSO sorting algorithm after tunables. */ _dl_sort_maps_init (); - __brk (0); /* Initialize the break. */ + __brk (NULL); /* Initialize the break. */ #ifdef DL_PLATFORM_INIT DL_PLATFORM_INIT; diff --git a/sysdeps/unix/sysv/linux/gettimeofday.c b/sysdeps/unix/sysv/linux/gettimeofday.c index 5ca8916..3c97da0 100644 --- a/sysdeps/unix/sysv/linux/gettimeofday.c +++ b/sysdeps/unix/sysv/linux/gettimeofday.c @@ -31,7 +31,7 @@ static int __gettimeofday_syscall (struct timeval *restrict tv, void *restrict tz) { - if (__glibc_unlikely (tz != 0)) + if (__glibc_unlikely (tz != NULL)) memset (tz, 0, sizeof *tz); return INLINE_SYSCALL_CALL (gettimeofday, tv, tz); } @@ -47,7 +47,7 @@ libc_ifunc (__gettimeofday, int __gettimeofday (struct timeval *restrict tv, void *restrict tz) { - if (__glibc_unlikely (tz != 0)) + if (__glibc_unlikely (tz != NULL)) memset (tz, 0, sizeof *tz); return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); diff --git a/sysdeps/unix/sysv/linux/settimeofday.c b/sysdeps/unix/sysv/linux/settimeofday.c index 4235dc8..4fa1d66 100644 --- a/sysdeps/unix/sysv/linux/settimeofday.c +++ b/sysdeps/unix/sysv/linux/settimeofday.c @@ -26,9 +26,9 @@ int __settimeofday64 (const struct __timeval64 *tv, const struct timezone *tz) { /* Backwards compatibility for setting the UTC offset. */ - if (__glibc_unlikely (tz != 0)) + if (__glibc_unlikely (tz != NULL)) { - if (tv != 0) + if (tv != NULL) { __set_errno (EINVAL); return -1; diff --git a/sysdeps/unix/sysv/linux/sigwait.c b/sysdeps/unix/sysv/linux/sigwait.c index 37de8db..f0dff83 100644 --- a/sysdeps/unix/sysv/linux/sigwait.c +++ b/sysdeps/unix/sysv/linux/sigwait.c @@ -25,7 +25,7 @@ __sigwait (const sigset_t *set, int *sig) siginfo_t si; int ret; do - ret = __sigtimedwait (set, &si, 0); + ret = __sigtimedwait (set, &si, NULL); /* Applications do not expect sigwait to return with EINTR, and the error code is not specified by POSIX. */ while (ret < 0 && errno == EINTR); diff --git a/sysdeps/unix/sysv/linux/sigwaitinfo.c b/sysdeps/unix/sysv/linux/sigwaitinfo.c index dba25bd..1d48b11 100644 --- a/sysdeps/unix/sysv/linux/sigwaitinfo.c +++ b/sysdeps/unix/sysv/linux/sigwaitinfo.c @@ -22,7 +22,7 @@ int __sigwaitinfo (const sigset_t *set, siginfo_t *info) { - return __sigtimedwait (set, info, 0); + return __sigtimedwait (set, info, NULL); } libc_hidden_def (__sigwaitinfo) diff --git a/sysdeps/unix/sysv/linux/spawni.c b/sysdeps/unix/sysv/linux/spawni.c index 1edf62c..85796c6 100644 --- a/sysdeps/unix/sysv/linux/spawni.c +++ b/sysdeps/unix/sysv/linux/spawni.c @@ -115,7 +115,7 @@ __spawni_child (void *arguments) memset (&sa, '\0', sizeof (sa)); sigset_t hset; - __sigprocmask (SIG_BLOCK, 0, &hset); + __sigprocmask (SIG_BLOCK, NULL, &hset); for (int sig = 1; sig < _NSIG; ++sig) { if ((attr->__flags & POSIX_SPAWN_SETSIGDEF) @@ -129,7 +129,7 @@ __spawni_child (void *arguments) sa.sa_handler = SIG_IGN; else { - __libc_sigaction (sig, 0, &sa); + __libc_sigaction (sig, NULL, &sa); if (sa.sa_handler == SIG_IGN || sa.sa_handler == SIG_DFL) continue; sa.sa_handler = SIG_DFL; @@ -138,7 +138,7 @@ __spawni_child (void *arguments) else continue; - __libc_sigaction (sig, &sa, 0); + __libc_sigaction (sig, &sa, NULL); } #ifdef _POSIX_PRIORITY_SCHEDULING @@ -172,7 +172,7 @@ __spawni_child (void *arguments) goto fail; /* Execute the file actions. */ - if (file_actions != 0) + if (file_actions != NULL) { int cnt; struct rlimit64 fdlimit; |