[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/4] localename: -Wtautological-pointer-compare
From: |
Paul Eggert |
Subject: |
[PATCH 1/4] localename: -Wtautological-pointer-compare |
Date: |
Fri, 13 Jan 2023 12:17:01 -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 | 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 <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.
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
- [PATCH 1/4] localename: -Wtautological-pointer-compare,
Paul Eggert <=