From: Paul Eggert Date: Fri, 13 Jan 2023 18:50:12 +0000 (-0800) Subject: localename: -Wtautological-pointer-compare X-Git-Tag: v1.0~1842 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=9441e9eb30a9483729bc692c97e3a47a350599eb;p=gnulib.git 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. --- 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 ();