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 /locale | |
| parent | 83d4b42ded712bbbc22ceeefe886b8315190da5b (diff) | |
| download | glibc-53fcdf5f743aa9b02972eec658e66f96d6a63386.tar.xz glibc-53fcdf5f743aa9b02972eec658e66f96d6a63386.zip | |
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 'locale')
| -rw-r--r-- | locale/programs/xmalloc.c | 12 | ||||
| -rw-r--r-- | locale/setlocale.c | 2 | ||||
| -rw-r--r-- | locale/uselocale.c | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/locale/programs/xmalloc.c b/locale/programs/xmalloc.c index 4ae46b9003..38f2bc8a2c 100644 --- a/locale/programs/xmalloc.c +++ b/locale/programs/xmalloc.c @@ -56,10 +56,10 @@ fixup_null_alloc (size_t n) { VOID *p; - p = 0; + p = NULL; if (n == 0) p = malloc ((size_t) 1); - if (p == 0) + if (p == NULL) error (xmalloc_exit_failure, 0, _("memory exhausted")); return p; } @@ -72,7 +72,7 @@ xmalloc (size_t n) VOID *p; p = malloc (n); - if (p == 0) + if (p == NULL) p = fixup_null_alloc (n); return p; } @@ -85,7 +85,7 @@ xcalloc (size_t n, size_t s) VOID *p; p = calloc (n, s); - if (p == 0) + if (p == NULL) p = fixup_null_alloc (n); return p; } @@ -97,10 +97,10 @@ xcalloc (size_t n, size_t s) VOID * xrealloc (VOID *p, size_t n) { - if (p == 0) + if (p == NULL) return xmalloc (n); p = realloc (p, n); - if (p == 0) + if (p == NULL) p = fixup_null_alloc (n); return p; } diff --git a/locale/setlocale.c b/locale/setlocale.c index 7bd27e5398..fc5bf5c427 100644 --- a/locale/setlocale.c +++ b/locale/setlocale.c @@ -52,7 +52,7 @@ static char *const _nl_current_used[] = # undef DEFINE_CATEGORY }; -# define CATEGORY_USED(category) (_nl_current_used[category] != 0) +# define CATEGORY_USED(category) (_nl_current_used[category] != NULL) #else diff --git a/locale/uselocale.c b/locale/uselocale.c index 8136caf61b..5c7c1ad66b 100644 --- a/locale/uselocale.c +++ b/locale/uselocale.c @@ -54,7 +54,7 @@ __uselocale (locale_t newloc) extern char _nl_current_##category##_used; \ weak_extern (_nl_current_##category##_used) \ weak_extern (_nl_current_##category) \ - if (&_nl_current_##category##_used != 0) \ + if (&_nl_current_##category##_used != NULL) \ _nl_current_##category = &locobj->__locales[category]; \ } # include "categories.def" |
