From 9441e9eb30a9483729bc692c97e3a47a350599eb Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 13 Jan 2023 10:50:12 -0800 Subject: [PATCH] localename: -Wtautological-pointer-compare Problem found by xlclang 16.1 on AIX 7.2. * lib/localename.c (duplocale, freelocale): Omit unnecessary comparison of non-null args to NULL. --- ChangeLog | 7 +++++++ lib/localename.c | 6 +----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2485ffc919..916ed890c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2023-01-13 Paul Eggert + + localename: -Wtautological-pointer-compare + Problem found by xlclang 16.1 on AIX 7.2. + * lib/localename.c (duplocale, freelocale): + Omit unnecessary comparison of non-null args to NULL. + 2023-01-13 Bruno Haible login_tty tests: Be more verbose when the test fails. diff --git a/lib/localename.c b/lib/localename.c index a0e774ccea..5a178c68fe 100644 --- a/lib/localename.c +++ b/lib/localename.c @@ -2967,10 +2967,6 @@ duplocale (locale_t locale) struct locale_hash_node *node; locale_t result; - if (locale == NULL) - /* Invalid argument. */ - abort (); - node = (struct locale_hash_node *) malloc (sizeof (struct locale_hash_node)); if (node == NULL) /* errno is set to ENOMEM. */ @@ -3056,7 +3052,7 @@ void freelocale (locale_t locale) #undef freelocale { - if (locale == NULL || locale == LC_GLOBAL_LOCALE) + if (locale == LC_GLOBAL_LOCALE) /* Invalid argument. */ abort (); -- 2.39.5