mirror of
https://https.git.savannah.gnu.org/git/gnulib.git
synced 2026-05-13 15:13:36 +00:00
localename: Fix -Wtautological-pointer-compare warning in a better way.
* lib/localename.c (duplocale, freelocale): Revert last patch. (_GL_ARG_NONNULL): Define to empty.
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2023-01-13 Bruno Haible <bruno@clisp.org>
|
||||
|
||||
localename: Fix -Wtautological-pointer-compare warning in a better way.
|
||||
* lib/localename.c (duplocale, freelocale): Revert last patch.
|
||||
(_GL_ARG_NONNULL): Define to empty.
|
||||
|
||||
2023-01-13 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
verify: work around xlclang 16.1 compiler bug
|
||||
|
||||
@@ -18,6 +18,12 @@
|
||||
/* Native Windows code written by Tor Lillqvist <tml@iki.fi>. */
|
||||
/* Mac OS X code written by Bruno Haible <bruno@clisp.org>. */
|
||||
|
||||
/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
|
||||
optimizes away the locale == NULL tests below in duplocale() and freelocale(),
|
||||
or xlclang reports -Wtautological-pointer-compare warnings for these tests.
|
||||
*/
|
||||
#define _GL_ARG_NONNULL(params)
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
@@ -2967,6 +2973,10 @@ 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. */
|
||||
@@ -3052,7 +3062,7 @@ void
|
||||
freelocale (locale_t locale)
|
||||
#undef freelocale
|
||||
{
|
||||
if (locale == LC_GLOBAL_LOCALE)
|
||||
if (locale == NULL || locale == LC_GLOBAL_LOCALE)
|
||||
/* Invalid argument. */
|
||||
abort ();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user