]> Savannah Git Hosting - gnulib.git/commitdiff
localename: -Wtautological-pointer-compare
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 13 Jan 2023 18:50:12 +0000 (10:50 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 13 Jan 2023 20:15:50 +0000 (12:15 -0800)
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
lib/localename.c

index 2485ffc9199d098efc76290cb22437ab0d0c074c..916ed890c7f7297f8c635af99ccbcff15baec5bb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-01-13  Paul Eggert  <eggert@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  <bruno@clisp.org>
 
        login_tty tests: Be more verbose when the test fails.
index a0e774cceaf18eb7801291550de687e4ef5a7be5..5a178c68fec1a1566e482772b3d18f9ec6e64d38 100644 (file)
@@ -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 ();