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 /libio | |
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 'libio')
-rw-r--r-- | libio/fileops.c | 2 | ||||
-rw-r--r-- | libio/genops.c | 6 | ||||
-rw-r--r-- | libio/iopopen.c | 2 | ||||
-rw-r--r-- | libio/libioP.h | 5 | ||||
-rw-r--r-- | libio/wfileops.c | 2 | ||||
-rw-r--r-- | libio/wgenops.c | 2 |
6 files changed, 10 insertions, 9 deletions
diff --git a/libio/fileops.c b/libio/fileops.c index 4db4a76..759d737 100644 --- a/libio/fileops.c +++ b/libio/fileops.c @@ -220,7 +220,7 @@ _IO_new_file_fopen (FILE *fp, const char *filename, const char *mode, const char *last_recognized; if (_IO_file_is_open (fp)) - return 0; + return NULL; switch (*mode) { case 'r': diff --git a/libio/genops.c b/libio/genops.c index 6f20d49..9f18861 100644 --- a/libio/genops.c +++ b/libio/genops.c @@ -489,8 +489,8 @@ _IO_default_setbuf (FILE *fp, char *p, ssize_t len) fp->_flags &= ~_IO_UNBUFFERED; _IO_setb (fp, p, p+len, 0); } - fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end = 0; - fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_read_end = 0; + fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end = NULL; + fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_read_end = NULL; return fp; } @@ -971,7 +971,7 @@ _IO_unsave_markers (FILE *fp) struct _IO_marker *mark = fp->_markers; if (mark) { - fp->_markers = 0; + fp->_markers = NULL; } if (_IO_have_backup (fp)) diff --git a/libio/iopopen.c b/libio/iopopen.c index 352513a..6bf187e 100644 --- a/libio/iopopen.c +++ b/libio/iopopen.c @@ -106,7 +106,7 @@ spawn_process (posix_spawn_file_actions_t *fa, FILE *fp, const char *command, } } - err = __posix_spawn (&((_IO_proc_file *) fp)->pid, _PATH_BSHELL, fa, 0, + err = __posix_spawn (&((_IO_proc_file *) fp)->pid, _PATH_BSHELL, fa, NULL, (char *const[]){ (char*) "sh", (char*) "-c", (char*) "--", (char *) command, NULL }, __environ); if (err != 0) diff --git a/libio/libioP.h b/libio/libioP.h index a83a411..34bf91f 100644 --- a/libio/libioP.h +++ b/libio/libioP.h @@ -915,9 +915,10 @@ extern int _IO_vscanf (const char *, va_list) __THROW; # else # define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \ { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (FILE *) CHAIN, FD, \ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, \ + NULL, NULL, (FILE *) CHAIN, FD, \ 0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock, _IO_pos_BAD,\ - NULL, WDP, 0 } + NULL, WDP, NULL } # endif #else # ifdef _IO_USE_OLD_IO_FILE diff --git a/libio/wfileops.c b/libio/wfileops.c index fdbe869..16beab1 100644 --- a/libio/wfileops.c +++ b/libio/wfileops.c @@ -416,7 +416,7 @@ _IO_wfile_overflow (FILE *f, wint_t wch) || f->_wide_data->_IO_write_base == NULL) { /* Allocate a buffer if needed. */ - if (f->_wide_data->_IO_write_base == 0) + if (f->_wide_data->_IO_write_base == NULL) { _IO_wdoallocbuf (f); _IO_free_wbackup_area (f); diff --git a/libio/wgenops.c b/libio/wgenops.c index adfb970..f77a2d2 100644 --- a/libio/wgenops.c +++ b/libio/wgenops.c @@ -601,7 +601,7 @@ _IO_unsave_wmarkers (FILE *fp) struct _IO_marker *mark = fp->_markers; if (mark) { - fp->_markers = 0; + fp->_markers = NULL; } if (_IO_have_backup (fp)) |