1
0
mirror of https://git.savannah.gnu.org/git/gperf.git synced 2025-12-02 13:09:22 +00:00

build: Use more gnulib modules.

* autogen.sh (GNULIB_MODULES): Add read-file.
Copy also config.guess and config.sub.
* lib/Makefile.am (BUILT_SOURCES, MOSTLYCLEANDIRS): New variables.
(libgp_a_SOURCES): Remove getline.h, getline.cc.
* lib/getline.h: Remove file.
* lib/getline.cc: Remove file.
* src/configure.ac: Change config.h to also include ../lib/config.h.
* src/output.cc: Include <config.h> first.
* src/search.cc: Likewise.
* src/bool-array.cc: Include <config.h>.
* src/keyword.cc: Likewise.
* src/keyword-list.cc: Likewise.
* src/hash-table.cc: Likewise.
* src/main.cc: Likewise.
* src/options.cc: Likewise.
* src/positions.cc: Likewise.
* src/version.cc: Likewise.
* src/input.cc: Likewise. Include read-file.h instead of getline.h.
(Input<KT>::read_input): Use fread_file instead of get_delim.
This commit is contained in:
Bruno Haible
2025-04-16 22:06:58 +02:00
parent 5533d54f9a
commit 6ca5ea1384
19 changed files with 135 additions and 172 deletions

View File

@@ -1,5 +1,5 @@
/* Fast lookup table abstraction implemented as an Iteration Number Array
Copyright (C) 1989-1998, 2002-2003 Free Software Foundation, Inc.
Copyright (C) 1989-1998, 2002-2003, 2025 Free Software Foundation, Inc.
Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
and Bruno Haible <bruno@clisp.org>.
@@ -18,6 +18,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include "bool-array.h"

View File

@@ -1,6 +1,6 @@
dnl autoconf configuration for gperf/src
dnl Copyright (C) 1998-2024 Free Software Foundation, Inc.
dnl Copyright (C) 1998-2025 Free Software Foundation, Inc.
dnl Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
dnl and Bruno Haible <bruno@clisp.org>.
dnl
@@ -62,6 +62,16 @@ dnl
AC_CHECK_LIB([m], [rand], [GPERF_LIBM="-lm"], [GPERF_LIBM=""])
AC_SUBST([GPERF_LIBM])
dnl
dnl Include lib/config.h through src/config.h.
dnl
AH_BOTTOM([
#undef/**/PACKAGE_NAME
#undef/**/PACKAGE_STRING
#undef/**/PACKAGE_TARNAME
#undef/**/PACKAGE_VERSION
#include "../lib/config.h"
])
dnl
dnl That's it.
dnl
AC_CONFIG_FILES([Makefile])

View File

@@ -1,5 +1,5 @@
/* Hash table for checking keyword links. Implemented using double hashing.
Copyright (C) 1989-1998, 2000, 2002-2003 Free Software Foundation, Inc.
Copyright (C) 1989-1998, 2000, 2002-2003, 2025 Free Software Foundation, Inc.
Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
and Bruno Haible <bruno@clisp.org>.
@@ -18,6 +18,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include "hash-table.h"

View File

@@ -18,15 +18,17 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include "input.h"
#include <stdio.h>
#include <stdlib.h> /* declares exit() */
#include <stdlib.h> /* declares exit(), free() */
#include <string.h> /* declares strncpy(), strchr() */
#include <limits.h> /* defines UCHAR_MAX etc. */
#include "options.h"
#include "getline.h"
#include "read-file.h"
template <class KT>
Input<KT>::Input (FILE *stream, Keyword_Factory<KT> *keyword_factory)
@@ -251,10 +253,9 @@ template <class KT>
declaration lines starting with %, we go for the first interpretation,
otherwise for the second interpretation. */
char *input = NULL;
size_t input_size = 0;
int input_length = get_delim (&input, &input_size, EOF, _stream);
if (input_length < 0)
size_t input_length;
char *input = fread_file (_stream, 0, &input_length);
if (input == NULL)
{
if (ferror (_stream))
fprintf (stderr, "%s: error while reading input file\n",
@@ -1030,7 +1031,7 @@ template <class KT>
delete[] const_cast<char*>(_return_type);
delete[] const_cast<char*>(_struct_tag);
delete[] const_cast<char*>(_struct_decl);
delete[] _input;
free (_input);
}
/* ------------------------------------------------------------------------- */

View File

@@ -18,6 +18,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include "keyword-list.h"

View File

@@ -18,6 +18,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include "keyword.h"

View File

@@ -18,6 +18,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@@ -18,6 +18,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include "options.h"

View File

@@ -18,6 +18,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include "output.h"
@@ -28,7 +30,6 @@
#include <limits.h> /* defines SCHAR_MAX etc. */
#include "options.h"
#include "version.h"
#include "config.h"
/* ============================== Portability ============================== */

View File

@@ -1,5 +1,5 @@
/* A set of byte positions.
Copyright (C) 1989-1998, 2000, 2002-2003 Free Software Foundation, Inc.
Copyright (C) 1989-1998, 2000, 2002-2003, 2025 Free Software Foundation, Inc.
Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
and Bruno Haible <bruno@clisp.org>.
@@ -18,6 +18,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include "positions.h"

View File

@@ -1,5 +1,5 @@
/* Search algorithm.
Copyright (C) 1989-1998, 2000, 2002-2003, 2009, 2016 Free Software Foundation, Inc.
Copyright (C) 1989-1998, 2000, 2002-2003, 2009, 2016, 2025 Free Software Foundation, Inc.
Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
and Bruno Haible <bruno@clisp.org>.
@@ -18,6 +18,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include "search.h"
@@ -29,7 +31,6 @@
#include <limits.h> /* defines INT_MIN, INT_MAX, UINT_MAX */
#include "options.h"
#include "hash-table.h"
#include "config.h"
/* ============================== Portability ============================== */

View File

@@ -19,6 +19,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include "version.h"