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  <egg...@cs.ucla.edu>
+
+       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  <br...@clisp.org>
 
        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.37.2


Reply via email to