]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Fix some -Wzero-as-null-pointer-constant warnings. master
authorBruno Haible <bruno@clisp.org>
Sat, 17 Jan 2026 03:39:12 +0000 (04:39 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 17 Jan 2026 03:39:12 +0000 (04:39 +0100)
* gnulib-local/lib/backupfile.c (max_backup_version, backup_args, get_version):
Write NULL instead of 0.
* gettext-tools/src/x-go.c (add_to_hash_table): Likewise.

gettext-tools/src/x-go.c
gnulib-local/lib/backupfile.c

index b5e6f86e38fa3a439a3a338bd40c78a280f5815b..0dbd7da4af908c3a407f8c824f0c4cb447494e5c 100644 (file)
@@ -1,5 +1,5 @@
 /* xgettext Go backend.
-   Copyright (C) 2001-2025 Free Software Foundation, Inc.
+   Copyright (C) 2001-2026 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -393,7 +393,7 @@ struct go_package
 static void
 add_to_hash_table (hash_table *htab, const char *name, go_type_t *type)
 {
-  if (hash_insert_entry (htab, name, strlen (name), type) == 0)
+  if (hash_insert_entry (htab, name, strlen (name), type) == NULL)
     /* We have duplicates!  */
     abort ();
 }
index c94fc21b72bcde1e2d60cc5f3a0de125f71a5ce1..d0b0c9381115676a3f635235b24f7bc97ec0b2a3 100644 (file)
@@ -1,5 +1,5 @@
 /* backupfile.c -- make Emacs style backup file names
-   Copyright (C) 1990-2003, 2005-2006, 2012, 2020, 2025 Free Software Foundation, Inc.
+   Copyright (C) 1990-2026 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -139,7 +139,7 @@ max_backup_version (const char *file, const char *dir)
   size_t file_name_length = strlen (file);
 
   struct dirent *dp;
-  while ((dp = readdir (dirp)) != 0)
+  while ((dp = readdir (dirp)) != NULL)
     {
       if (REAL_DIR_ENTRY (dp) && strlen (dp->d_name) >= file_name_length + 4)
         {
@@ -186,7 +186,7 @@ static const char * const backup_args[] =
   "simple", "never",
   "existing", "nil",
   "numbered", "t",
-  0
+  NULL
 };
 
 static const enum backup_type backup_types[] =
@@ -205,7 +205,7 @@ static const enum backup_type backup_types[] =
 enum backup_type
 get_version (const char *context, const char *version)
 {
-  if (version == 0 || *version == 0)
+  if (version == NULL || *version == '\0')
     return numbered_existing;
   else
     return XARGMATCH (context, version, backup_args, backup_types);