]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
libgettextpo: Don't use static variable gram_max_allowed_errors.
authorBruno Haible <bruno@clisp.org>
Sat, 3 Aug 2024 12:28:32 +0000 (14:28 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 4 Aug 2024 23:04:02 +0000 (01:04 +0200)
* gettext-tools/src/read-po.h (gram_max_allowed_errors): New declaration.
* gettext-tools/src/read-po-lex.h (gram_max_allowed_errors): Remove declaration.
* gettext-tools/src/read-po.c: Include <limits.h>.
(gram_max_allowed_errors): Moved to here. Change initial value to UINT_MAX.
* gettext-tools/src/read-po-lex.c: Include read-po.h.
(gram_max_allowed_errors): Remove variable.
* gettext-tools/libgettextpo/gettext-po.c: Don't include read-po-lex.h.
(po_file_read): Don't assign gram_max_allowed_errors.
* gettext-tools/src/msgattrib.c (main): Initialize gram_max_allowed_errors.
* gettext-tools/src/msgcat.c (main): Likewise.
* gettext-tools/src/msgcomm.c (main): Likewise.
* gettext-tools/src/msgconv.c (main): Likewise.
* gettext-tools/src/msgen.c (main): Likewise.
* gettext-tools/src/msgexec.c (main): Likewise.
* gettext-tools/src/msgfilter.c (main): Likewise.
* gettext-tools/src/msggrep.c (main): Likewise.
* gettext-tools/src/msginit.c (main): Likewise.
* gettext-tools/src/msguniq.c (main): Likewise.
* gettext-tools/src/xgettext.c (main): Likewise.
* gettext-tools/src/msgcmp.c: Don't include read-po-lex.h.
* gettext-tools/src/msgmerge.c: Likewise.
* gettext-tools/src/msgfmt.c: Don't include read-po-lex.h.
(main): Initialize gram_max_allowed_errors.

19 files changed:
gettext-tools/libgettextpo/gettext-po.c
gettext-tools/src/msgattrib.c
gettext-tools/src/msgcat.c
gettext-tools/src/msgcmp.c
gettext-tools/src/msgcomm.c
gettext-tools/src/msgconv.c
gettext-tools/src/msgen.c
gettext-tools/src/msgexec.c
gettext-tools/src/msgfilter.c
gettext-tools/src/msgfmt.c
gettext-tools/src/msggrep.c
gettext-tools/src/msginit.c
gettext-tools/src/msgmerge.c
gettext-tools/src/msguniq.c
gettext-tools/src/read-po-lex.c
gettext-tools/src/read-po-lex.h
gettext-tools/src/read-po.c
gettext-tools/src/read-po.h
gettext-tools/src/xgettext.c

index acbd4f37ee0961369b399c533ad3b5db0add45c9..22a50c1dfc4a16bf329c5adcc95f62ed6a94e0ee 100644 (file)
@@ -31,7 +31,6 @@
 #include "xalloc.h"
 #include "read-catalog.h"
 #include "read-po.h"
-#include "read-po-lex.h"
 #include "write-catalog.h"
 #include "write-po.h"
 #include "xvasprintf.h"
@@ -113,7 +112,6 @@ po_file_read (const char *filename, po_xerror_handler_t handler)
       handler->xerror2,
       &error_count
     };
-  gram_max_allowed_errors = UINT_MAX;
 
   file = XMALLOC (struct po_file);
   file->real_filename = filename;
@@ -123,9 +121,6 @@ po_file_read (const char *filename, po_xerror_handler_t handler)
                                     &local_xerror_handler);
   file->domains = NULL;
 
-  /* Restore.  */
-  gram_max_allowed_errors = 20;
-
   if (fp != stdin)
     fclose (fp);
   return file;
index 67407807ad89be47eb15b7f375795d70a6c0d0a7..3112622ddfade2637b0f3dabce046c64cad823a0 100644 (file)
@@ -154,6 +154,7 @@ main (int argc, char **argv)
   /* Set program name for messages.  */
   set_program_name (argv[0]);
   error_print_progname = maybe_print_progname;
+  gram_max_allowed_errors = 20;
 
   /* Set locale via LC_ALL.  */
   setlocale (LC_ALL, "");
index 2fb6ad35675bd3db604b0bee9f4b527da8a9234a..eb7c44909584e31845e61a7c3df051e7256b79bc 100644 (file)
@@ -122,6 +122,7 @@ main (int argc, char **argv)
   /* Set program name for messages.  */
   set_program_name (argv[0]);
   error_print_progname = maybe_print_progname;
+  gram_max_allowed_errors = 20;
 
   /* Set locale via LC_ALL.  */
   setlocale (LC_ALL, "");
index 2b744397b8572338227d9db3063fd3b0828c37c1..d0c345a1033aaba71cd1615a795a882cec8b8117 100644 (file)
@@ -37,7 +37,6 @@
 #include "message.h"
 #include "read-catalog-file.h"
 #include "read-po.h"
-#include "read-po-lex.h"
 #include "read-properties.h"
 #include "read-stringtable.h"
 #include "xmalloca.h"
index a740a661b699c4c5ec7becb2b6308b27493ea61f..23f939775fb3e4f23259f8553462bf00348e0d16 100644 (file)
@@ -121,6 +121,7 @@ main (int argc, char *argv[])
   /* Set program name for messages.  */
   set_program_name (argv[0]);
   error_print_progname = maybe_print_progname;
+  gram_max_allowed_errors = 20;
 
   /* Set locale via LC_ALL.  */
   setlocale (LC_ALL, "");
index a5a6787940d32fa3680a9174215ea9e351489bf7..5c4f34ae8fde84d6f89a158c29e26decf76949d0 100644 (file)
@@ -110,6 +110,7 @@ main (int argc, char **argv)
   /* Set program name for messages.  */
   set_program_name (argv[0]);
   error_print_progname = maybe_print_progname;
+  gram_max_allowed_errors = 20;
 
   /* Set locale via LC_ALL.  */
   setlocale (LC_ALL, "");
index c635b8f950b87d075abd4ea7dc8ed3a0420a201c..b8c2210b6aaad5a0d25cd3b8dd9b567f889ffcab 100644 (file)
@@ -108,6 +108,7 @@ main (int argc, char **argv)
   /* Set program name for messages.  */
   set_program_name (argv[0]);
   error_print_progname = maybe_print_progname;
+  gram_max_allowed_errors = 20;
 
   /* Set locale via LC_ALL.  */
   setlocale (LC_ALL, "");
index 47707b85539f733c388c7a727ed71b5fe3658886..762edecd47d3c505d1f4826e8e2f8d5bd70d3fc9 100644 (file)
@@ -110,6 +110,7 @@ main (int argc, char **argv)
   /* Set program name for messages.  */
   set_program_name (argv[0]);
   error_print_progname = maybe_print_progname;
+  gram_max_allowed_errors = 20;
 
   /* Set locale via LC_ALL.  */
   setlocale (LC_ALL, "");
index 174498154e15f56e498466c9891f0155b08771f9..74b1ba3c6ad6e109ec5ad790575b9731cf38512a 100644 (file)
@@ -144,6 +144,7 @@ main (int argc, char **argv)
   /* Set program name for messages.  */
   set_program_name (argv[0]);
   error_print_progname = maybe_print_progname;
+  gram_max_allowed_errors = 20;
 
   /* Set locale via LC_ALL.  */
   setlocale (LC_ALL, "");
index f7aa19bfb9cef5c56dea6c314a8d6f837e191265..e0819489e2f2cb32ffefb255c7e391ccd1d61471 100644 (file)
@@ -57,7 +57,6 @@
 #include "open-catalog.h"
 #include "read-catalog-file.h"
 #include "read-po.h"
-#include "read-po-lex.h"
 #include "read-properties.h"
 #include "read-stringtable.h"
 #include "read-desktop.h"
@@ -259,6 +258,7 @@ main (int argc, char *argv[])
   error_print_progname = maybe_print_progname;
   error_one_per_line = 1;
   exit_status = EXIT_SUCCESS;
+  gram_max_allowed_errors = 20;
 
   /* Set locale via LC_ALL.  */
   setlocale (LC_ALL, "");
index 7d773a4b8a91d923593a5d766fa9bc86e614af09..08fa7ca2f73e1b89d97a1fa9a2d03261337929d8 100644 (file)
@@ -157,6 +157,7 @@ main (int argc, char **argv)
   /* Set program name for messages.  */
   set_program_name (argv[0]);
   error_print_progname = maybe_print_progname;
+  gram_max_allowed_errors = 20;
 
   /* Set locale via LC_ALL.  */
   setlocale (LC_ALL, "");
index 1258fecc601d376f7a1b3022bbb9a0be476f5870..5a66f7fda08e4afd852e50730821f8c54d2df6f9 100644 (file)
@@ -153,6 +153,7 @@ main (int argc, char **argv)
   /* Set program name for messages.  */
   set_program_name (argv[0]);
   error_print_progname = maybe_print_progname;
+  gram_max_allowed_errors = 20;
 
   /* Set locale via LC_ALL.  */
   setlocale (LC_ALL, "");
index 8cc278beca9fa592e34fb0245d2d83178cec5557..7e1b770a3643063f55a04c0b608b73af200693b7 100644 (file)
@@ -44,7 +44,6 @@
 #include "message.h"
 #include "read-catalog-file.h"
 #include "read-po.h"
-#include "read-po-lex.h"
 #include "read-properties.h"
 #include "read-stringtable.h"
 #include "write-catalog.h"
index 692af237edb031f8248fc26a8ed3ffc794489ca2..457c7d27bdddafa520be365c469c6ac6c3e8d6f2 100644 (file)
@@ -114,6 +114,7 @@ main (int argc, char **argv)
   /* Set program name for messages.  */
   set_program_name (argv[0]);
   error_print_progname = maybe_print_progname;
+  gram_max_allowed_errors = 20;
 
   /* Set locale via LC_ALL.  */
   setlocale (LC_ALL, "");
index 3b2d14b62e7a187607735b7937d73602446c3a94..6a6c3cb961963095da89d51f3fffc09342dc5fd9 100644 (file)
@@ -56,6 +56,7 @@
 #include "pos.h"
 #include "message.h"
 #include "str-list.h"
+#include "read-po.h"
 #include "read-po-internal.h"
 #include "read-po-gram.h"
 
@@ -818,11 +819,6 @@ mbfile_ungetc (const mbchar_t mbc, mbfile_t mbf)
 }
 
 
-/* Lexer variables.  */
-
-unsigned int gram_max_allowed_errors = 20;
-
-
 /* Prepare lexical analysis.  */
 void
 lex_start (struct po_parser_state *ps,
index 57a2b68f5c2ce5baaf5251eec569a75ed9ee02f0..ac4e6c092dc9b4ada559ebc32deed865b830563d 100644 (file)
@@ -52,12 +52,6 @@ extern "C" {
 
 struct po_parser_state;
 
-/* Global variables from read-po-lex.c.  */
-
-/* Number of parse errors within a PO file that cause the program to
-   terminate.  Cf. error_message_count, declared in <error.h>.  */
-extern DLL_VARIABLE unsigned int gram_max_allowed_errors;
-
 
 /* Prepare lexical analysis.  */
 extern void lex_start (struct po_parser_state *ps,
index 3b4cd1b5b6c81e86d87cef970e35804c5e7fced0..f817be9f71c2b724814aa63156442ad6c663f1ff 100644 (file)
@@ -21,6 +21,8 @@
 /* Specification.  */
 #include "read-po.h"
 
+#include <limits.h>
+
 #include "read-po-lex.h"
 #include "read-po-internal.h"
 
@@ -45,3 +47,8 @@ const struct catalog_input_format input_format_po =
   po_parse,                             /* parse */
   false                                 /* produces_utf8 */
 };
+
+
+/* Lexer variables.  */
+
+unsigned int gram_max_allowed_errors = UINT_MAX;
index 98fc893b226c6dc93713bd0e8074554a84c35908..baf6bbae55adefd46e884828b9c40517cc4f6b6b 100644 (file)
@@ -1,5 +1,5 @@
 /* Reading PO files.
-   Copyright (C) 2006, 2019 Free Software Foundation, Inc.
+   Copyright (C) 2006-2024 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2006.
 
    This program is free software: you can redistribute it and/or modify
@@ -30,6 +30,13 @@ extern "C" {
 extern DLL_VARIABLE const struct catalog_input_format input_format_po;
 
 
+/* Global variables.  */
+
+/* Number of parse errors within a PO file that cause the program to
+   terminate.  Cf. error_message_count, declared in <error.h>.  */
+extern DLL_VARIABLE unsigned int gram_max_allowed_errors;
+
+
 #ifdef __cplusplus
 }
 #endif
index 5ae03e69e67db6f52f62173b000f66f8531b01fd..25179ea89fc02a0df0c2283072ce2905bdbb3e5b 100644 (file)
@@ -351,6 +351,7 @@ main (int argc, char *argv[])
   /* Set program name for messages.  */
   set_program_name (argv[0]);
   error_print_progname = maybe_print_progname;
+  gram_max_allowed_errors = 20;
 
   /* Set locale via LC_ALL.  */
   setlocale (LC_ALL, "");