From: Bruno Haible Date: Sat, 11 Nov 2023 15:48:00 +0000 (+0100) Subject: libgettextpo: Remove static variable 'directory'. X-Git-Tag: v0.23~314 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e89d220852145522cd3d94639165a5ae5e49faa;p=thirdparty%2Fgettext.git libgettextpo: Remove static variable 'directory'. * gettext-tools/src/read-catalog-file.h: New file, extracted from gettext-tools/src/read-catalog.h. * gettext-tools/src/read-catalog.h (read_catalog_file): Remove declaration. * gettext-tools/src/read-catalog-file.c: New file, extracted from gettext-tools/src/read-catalog.c. * gettext-tools/src/read-catalog.c: Don't include open-catalog.h. (read_catalog_file): Remove function. * gettext-tools/src/msgl-cat.c: Include read-catalog-file.h instead of read-catalog.h. * gettext-tools/src/msgattrib.c: Likewise. * gettext-tools/src/msgcmp.c: Likewise. * gettext-tools/src/msgconv.c: Likewise. * gettext-tools/src/msgen.c: Likewise. * gettext-tools/src/msgexec.c: Likewise. * gettext-tools/src/msgfilter.c: Likewise. * gettext-tools/src/msgfmt.c: Likewise. * gettext-tools/src/msggrep.c: Likewise. * gettext-tools/src/msginit.c: Likewise. * gettext-tools/src/msgmerge.c: Likewise. * gettext-tools/src/FILES: Mention read-catalog-file.h, read-catalog-file.c. * gettext-tools/src/Makefile.am (noinst_HEADERS): Add read-catalog-file.h. (libgettextsrc_la_SOURCES): Add read-catalog-file.c. * gettext-tools/libgettextpo/Makefile.am (libgettextpo_la_AUXSOURCES): Remove dir-list.c, open-catalog.c. --- diff --git a/gettext-tools/libgettextpo/Makefile.am b/gettext-tools/libgettextpo/Makefile.am index 0fe0995d0..090efbd76 100644 --- a/gettext-tools/libgettextpo/Makefile.am +++ b/gettext-tools/libgettextpo/Makefile.am @@ -54,7 +54,6 @@ libgettextpo_la_SOURCES = \ # These are auxiliary sources whose symbols should not be exported. libgettextpo_la_AUXSOURCES = \ ../src/str-list.c \ - ../src/dir-list.c \ ../src/message.c \ ../src/pos.c \ ../src/msgl-ascii.c \ @@ -62,7 +61,6 @@ libgettextpo_la_AUXSOURCES = \ ../src/po-xerror.c \ ../src/write-catalog.c \ ../src/write-po.c \ - ../src/open-catalog.c \ ../src/po-charset.c \ ../src/po-lex.c \ ../src/po-gram-gen.c \ diff --git a/gettext-tools/src/FILES b/gettext-tools/src/FILES index 68ba0127a..ff1fa3dd1 100644 --- a/gettext-tools/src/FILES +++ b/gettext-tools/src/FILES @@ -110,6 +110,8 @@ po-xerror.c | | read-catalog.h | read-catalog.c +| read-catalog-file.h +| read-catalog-file.c | Reading of a PO file, returning a list-of-messages. | | read-desktop.h diff --git a/gettext-tools/src/Makefile.am b/gettext-tools/src/Makefile.am index dcf98880e..4f60cc40c 100644 --- a/gettext-tools/src/Makefile.am +++ b/gettext-tools/src/Makefile.am @@ -38,7 +38,7 @@ lib_LTLIBRARIES = libgettextsrc.la noinst_HEADERS = \ pos.h message.h po-error.h po-xerror.h po-gram.h po-charset.h \ po-lex.h open-catalog.h read-catalog-abstract.h read-catalog.h \ - read-po.h read-properties.h read-stringtable.h \ + read-catalog-file.h read-po.h read-properties.h read-stringtable.h \ str-list.h \ write-catalog.h write-po.h write-properties.h write-stringtable.h \ dir-list.h file-list.h po-gram-gen.h po-gram-gen2.h cldr-plural.h \ @@ -131,9 +131,9 @@ CSHARPCOMPFLAGS = @CSHARPCOMPFLAGS@ # read-csharp.c and read-resources.c.) # message.c -> str-list.c. # (read-catalog-abstract.c <--> po-gram-gen.y <--> po-lex.c) -> str-list.c. -# (read-catalog-abstract.c <--> po-gram-gen.y <--> po-lex.c) -> open-catalog.c -> dir-list.c -> str-list.c. # (read-catalog-abstract.c <--> po-gram-gen.y <--> po-lex.c) -> po-charset.c. # (read-catalog-abstract.c <--> po-gram-gen.y <--> po-lex.c) -> message.c -> str-list.c. +# read-catalog-file.c -> open-catalog.c -> dir-list.c -> str-list.c. COMMON_SOURCE = message.c pos.c po-error.c po-xerror.c \ read-catalog-abstract.c po-lex.c po-gram-gen.y po-charset.c \ read-po.c read-properties.c read-stringtable.c open-catalog.c \ @@ -180,7 +180,7 @@ FORMAT_SOURCE += \ # libgettextsrc contains all code that is needed by at least two programs. libgettextsrc_la_SOURCES = \ $(COMMON_SOURCE) \ - read-catalog.c \ + read-catalog.c read-catalog-file.c \ write-catalog.c write-properties.c write-stringtable.c write-po.c \ msgl-ascii.c \ msgl-ofn.c \ diff --git a/gettext-tools/src/msgattrib.c b/gettext-tools/src/msgattrib.c index b79c440b8..051afb142 100644 --- a/gettext-tools/src/msgattrib.c +++ b/gettext-tools/src/msgattrib.c @@ -37,7 +37,7 @@ #include "relocatable.h" #include "basename-lgpl.h" #include "message.h" -#include "read-catalog.h" +#include "read-catalog-file.h" #include "read-po.h" #include "read-properties.h" #include "read-stringtable.h" diff --git a/gettext-tools/src/msgcmp.c b/gettext-tools/src/msgcmp.c index e1ab1f2d6..17f6e4700 100644 --- a/gettext-tools/src/msgcmp.c +++ b/gettext-tools/src/msgcmp.c @@ -35,7 +35,7 @@ #include "relocatable.h" #include "basename-lgpl.h" #include "message.h" -#include "read-catalog.h" +#include "read-catalog-file.h" #include "read-po.h" #include "read-properties.h" #include "read-stringtable.h" diff --git a/gettext-tools/src/msgconv.c b/gettext-tools/src/msgconv.c index b0842c240..e51312511 100644 --- a/gettext-tools/src/msgconv.c +++ b/gettext-tools/src/msgconv.c @@ -37,7 +37,7 @@ #include "relocatable.h" #include "basename-lgpl.h" #include "message.h" -#include "read-catalog.h" +#include "read-catalog-file.h" #include "read-po.h" #include "read-properties.h" #include "read-stringtable.h" diff --git a/gettext-tools/src/msgen.c b/gettext-tools/src/msgen.c index a9591cfb7..31d34ca16 100644 --- a/gettext-tools/src/msgen.c +++ b/gettext-tools/src/msgen.c @@ -37,7 +37,7 @@ #include "relocatable.h" #include "basename-lgpl.h" #include "message.h" -#include "read-catalog.h" +#include "read-catalog-file.h" #include "read-po.h" #include "read-properties.h" #include "read-stringtable.h" diff --git a/gettext-tools/src/msgexec.c b/gettext-tools/src/msgexec.c index 61dd1f117..070224b81 100644 --- a/gettext-tools/src/msgexec.c +++ b/gettext-tools/src/msgexec.c @@ -41,7 +41,7 @@ #include "relocatable.h" #include "basename-lgpl.h" #include "message.h" -#include "read-catalog.h" +#include "read-catalog-file.h" #include "read-po.h" #include "read-properties.h" #include "read-stringtable.h" diff --git a/gettext-tools/src/msgfilter.c b/gettext-tools/src/msgfilter.c index c2bb9d369..5fb66f123 100644 --- a/gettext-tools/src/msgfilter.c +++ b/gettext-tools/src/msgfilter.c @@ -42,7 +42,7 @@ #include "relocatable.h" #include "basename-lgpl.h" #include "message.h" -#include "read-catalog.h" +#include "read-catalog-file.h" #include "read-po.h" #include "read-properties.h" #include "read-stringtable.h" diff --git a/gettext-tools/src/msgfmt.c b/gettext-tools/src/msgfmt.c index e14c96209..c84536cbf 100644 --- a/gettext-tools/src/msgfmt.c +++ b/gettext-tools/src/msgfmt.c @@ -54,7 +54,7 @@ #include "propername.h" #include "message.h" #include "open-catalog.h" -#include "read-catalog.h" +#include "read-catalog-file.h" #include "read-po.h" #include "read-properties.h" #include "read-stringtable.h" diff --git a/gettext-tools/src/msggrep.c b/gettext-tools/src/msggrep.c index 9200c75ca..8a875b765 100644 --- a/gettext-tools/src/msggrep.c +++ b/gettext-tools/src/msggrep.c @@ -48,7 +48,7 @@ #include "relocatable.h" #include "basename-lgpl.h" #include "message.h" -#include "read-catalog.h" +#include "read-catalog-file.h" #include "read-po.h" #include "read-properties.h" #include "read-stringtable.h" diff --git a/gettext-tools/src/msginit.c b/gettext-tools/src/msginit.c index 8ef758a82..c38560300 100644 --- a/gettext-tools/src/msginit.c +++ b/gettext-tools/src/msginit.c @@ -64,7 +64,7 @@ #include "c-strstr.h" #include "c-strcase.h" #include "message.h" -#include "read-catalog.h" +#include "read-catalog-file.h" #include "read-po.h" #include "read-properties.h" #include "read-stringtable.h" diff --git a/gettext-tools/src/msgl-cat.c b/gettext-tools/src/msgl-cat.c index 54bb92f33..a7c7592a9 100644 --- a/gettext-tools/src/msgl-cat.c +++ b/gettext-tools/src/msgl-cat.c @@ -34,7 +34,7 @@ #include "xerror.h" #include "xvasprintf.h" #include "message.h" -#include "read-catalog.h" +#include "read-catalog-file.h" #include "po-charset.h" #include "msgl-ascii.h" #include "msgl-ofn.h" diff --git a/gettext-tools/src/msgmerge.c b/gettext-tools/src/msgmerge.c index c3e614289..397fd675f 100644 --- a/gettext-tools/src/msgmerge.c +++ b/gettext-tools/src/msgmerge.c @@ -42,7 +42,7 @@ #include "relocatable.h" #include "basename-lgpl.h" #include "message.h" -#include "read-catalog.h" +#include "read-catalog-file.h" #include "read-po.h" #include "read-properties.h" #include "read-stringtable.h" diff --git a/gettext-tools/src/read-catalog-file.c b/gettext-tools/src/read-catalog-file.c new file mode 100644 index 000000000..759fb7adc --- /dev/null +++ b/gettext-tools/src/read-catalog-file.c @@ -0,0 +1,41 @@ +/* Reading PO files. + Copyright (C) 1995-2023 Free Software Foundation, Inc. + This file was written by Peter Miller + + 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 + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +/* Specification. */ +#include "read-catalog-file.h" + +#include "open-catalog.h" + + +msgdomain_list_ty * +read_catalog_file (const char *filename, catalog_input_format_ty input_syntax) +{ + char *real_filename; + FILE *fp = open_catalog_file (filename, &real_filename, true); + msgdomain_list_ty *result; + + result = read_catalog_stream (fp, real_filename, filename, input_syntax); + + if (fp != stdin) + fclose (fp); + + return result; +} diff --git a/gettext-tools/src/read-catalog-file.h b/gettext-tools/src/read-catalog-file.h new file mode 100644 index 000000000..fc057bf14 --- /dev/null +++ b/gettext-tools/src/read-catalog-file.h @@ -0,0 +1,43 @@ +/* Reading PO files. + Copyright (C) 1995-2023 Free Software Foundation, Inc. + This file was written by Bruno Haible . + + 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 + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef _READ_CATALOG_FILE_H +#define _READ_CATALOG_FILE_H + +#include "read-catalog.h" + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Read the input file with the name INPUT_NAME. The ending .po is added + if necessary. If INPUT_NAME is not an absolute file name and the file is + not found, the list of directories in "dir-list.h" is searched. Returns + a list of messages. */ +extern msgdomain_list_ty * + read_catalog_file (const char *input_name, + catalog_input_format_ty input_syntax); + + +#ifdef __cplusplus +} +#endif + + +#endif /* _READ_CATALOG_FILE_H */ diff --git a/gettext-tools/src/read-catalog.c b/gettext-tools/src/read-catalog.c index 2dd3bd66a..3ae2d702c 100644 --- a/gettext-tools/src/read-catalog.c +++ b/gettext-tools/src/read-catalog.c @@ -26,7 +26,6 @@ #include #include -#include "open-catalog.h" #include "po-charset.h" #include "po-xerror.h" #include "xalloc.h" @@ -484,19 +483,3 @@ read_catalog_stream (FILE *fp, const char *real_filename, catalog_reader_free ((abstract_catalog_reader_ty *) pop); return mdlp; } - - -msgdomain_list_ty * -read_catalog_file (const char *filename, catalog_input_format_ty input_syntax) -{ - char *real_filename; - FILE *fp = open_catalog_file (filename, &real_filename, true); - msgdomain_list_ty *result; - - result = read_catalog_stream (fp, real_filename, filename, input_syntax); - - if (fp != stdin) - fclose (fp); - - return result; -} diff --git a/gettext-tools/src/read-catalog.h b/gettext-tools/src/read-catalog.h index b928137dd..238524f0d 100644 --- a/gettext-tools/src/read-catalog.h +++ b/gettext-tools/src/read-catalog.h @@ -1,6 +1,5 @@ /* Reading PO files. - Copyright (C) 1995-1998, 2000-2003, 2005-2006, 2008-2009, 2014-2015 Free - Software Foundation, Inc. + Copyright (C) 1995-2023 Free Software Foundation, Inc. This file was written by Bruno Haible . This program is free software: you can redistribute it and/or modify @@ -177,14 +176,6 @@ extern msgdomain_list_ty * const char *logical_filename, catalog_input_format_ty input_syntax); -/* Read the input file with the name INPUT_NAME. The ending .po is added - if necessary. If INPUT_NAME is not an absolute file name and the file is - not found, the list of directories in "dir-list.h" is searched. Returns - a list of messages. */ -extern msgdomain_list_ty * - read_catalog_file (const char *input_name, - catalog_input_format_ty input_syntax); - #ifdef __cplusplus }