From 53fcdf5f743aa9b02972eec658e66f96d6a63386 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Sat, 16 Nov 2024 16:51:31 +0100 Subject: 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: Link: Signed-off-by: Alejandro Colomar --- libio/fileops.c | 2 +- libio/genops.c | 6 +++--- libio/iopopen.c | 2 +- libio/libioP.h | 5 +++-- libio/wfileops.c | 2 +- libio/wgenops.c | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) (limited to 'libio') diff --git a/libio/fileops.c b/libio/fileops.c index 4db4a76f75..759d737ec7 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 6f20d49669..9f18861d7b 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 352513a291..6bf187e2d5 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 a83a411fdf..34bf91fcd8 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 fdbe8692e8..16beab1f3a 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 adfb97014f..f77a2d22f0 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)) -- cgit v1.2.3