]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Silence "initialization discards ‘const’ qualifier from pointer target type" warnings.
authorBruno Haible <bruno@clisp.org>
Fri, 2 Jun 2023 23:31:33 +0000 (01:31 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 4 Jun 2023 13:54:10 +0000 (15:54 +0200)
* gettext-tools/src/pos.h (struct lex_pos_ty): Change type of file_name field to
'const char *'.
* gettext-tools/src/read-catalog.c (default_destructor,
default_reset_comment_state): Cast file_name to 'char *' before free()ing it.
* gettext-tools/src/xg-arglist-parser.h (arglist_parser_remember,
arglist_parser_remember_msgctxt): Change type of file_name parameter.
* gettext-tools/src/xg-arglist-parser.c (arglist_parser_remember,
arglist_parser_remember_msgctxt): Likewise.

gettext-tools/src/pos.h
gettext-tools/src/read-catalog.c
gettext-tools/src/xg-arglist-parser.c
gettext-tools/src/xg-arglist-parser.h

index ce2b002b31980257c0e668c01bd0c40d31b2209b..8167c7f60cbdc11ae470e2f9f841981a7397dbd1 100644 (file)
@@ -1,5 +1,5 @@
 /* Source file positions.
-   Copyright (C) 1995-1998, 2000-2001, 2021 Free Software Foundation, Inc.
+   Copyright (C) 1995-1998, 2000-2001, 2021, 2023 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
@@ -28,7 +28,7 @@
 typedef struct lex_pos_ty lex_pos_ty;
 struct lex_pos_ty
 {
-  char *file_name;
+  const char *file_name;
   size_t line_number;
 };
 
index 08fabb87b245d2aba5af8ad66697371478fac760..c593ca98e0ad84df6114ff146d9a10143000fdde 100644 (file)
@@ -1,6 +1,5 @@
 /* Reading PO files.
-   Copyright (C) 1995-1998, 2000-2003, 2005-2006, 2008-2009, 2014-2016 Free
-   Software Foundation, Inc.
+   Copyright (C) 1995-1998, 2000-2003, 2005-2006, 2008-2009, 2014-2016, 2023 Free Software Foundation, Inc.
    This file was written by Peter Miller <millerp@canb.auug.org.au>
 
    This program is free software: you can redistribute it and/or modify
@@ -127,7 +126,7 @@ default_destructor (abstract_catalog_reader_ty *that)
     }
 
   for (j = 0; j < this->filepos_count; ++j)
-    free (this->filepos[j].file_name);
+    free ((char *) this->filepos[j].file_name);
   if (this->filepos != NULL)
     free (this->filepos);
 }
@@ -199,7 +198,7 @@ default_reset_comment_state (default_catalog_reader_ty *this)
         }
     }
   for (j = 0; j < this->filepos_count; ++j)
-    free (this->filepos[j].file_name);
+    free ((char *) this->filepos[j].file_name);
   if (this->filepos != NULL)
     free (this->filepos);
   this->filepos_count = 0;
index cc30bfc943009dde9f8f151b242c400568757862..cadcb18c391aaa5be94cef957ae891c148d50b36 100644 (file)
@@ -147,7 +147,7 @@ void
 arglist_parser_remember (struct arglist_parser *ap,
                          int argnum, mixed_string_ty *string,
                          flag_context_ty context,
-                         char *file_name, size_t line_number,
+                         const char *file_name, size_t line_number,
                          refcounted_string_list_ty *comment,
                          bool comment_is_utf8)
 {
@@ -207,7 +207,7 @@ void
 arglist_parser_remember_msgctxt (struct arglist_parser *ap,
                                  mixed_string_ty *string,
                                  flag_context_ty context,
-                                 char *file_name, size_t line_number)
+                                 const char *file_name, size_t line_number)
 {
   bool stored_string = false;
   size_t nalternatives = ap->nalternatives;
index 9f2dedca06814de2882d930e896d8059518c41f2..4c813e983c281b5d7f5844d950e81af893dee6b0 100644 (file)
@@ -86,7 +86,7 @@ extern struct arglist_parser * arglist_parser_clone (struct arglist_parser *ap);
 extern void arglist_parser_remember (struct arglist_parser *ap,
                                      int argnum, mixed_string_ty *string,
                                      flag_context_ty context,
-                                     char *file_name, size_t line_number,
+                                     const char *file_name, size_t line_number,
                                      refcounted_string_list_ty *comment,
                                      bool comment_is_utf8);
 /* Adds a string argument as msgctxt to an arglist_parser, without incrementing
@@ -96,7 +96,7 @@ extern void arglist_parser_remember (struct arglist_parser *ap,
 extern void arglist_parser_remember_msgctxt (struct arglist_parser *ap,
                                              mixed_string_ty *string,
                                              flag_context_ty context,
-                                             char *file_name, size_t line_number);
+                                             const char *file_name, size_t line_number);
 /* Tests whether an arglist_parser has is not waiting for more arguments after
    argument ARGNUM.  */
 extern bool arglist_parser_decidedp (struct arglist_parser *ap, int argnum);