1
0
mirror of https://git.savannah.gnu.org/git/gperf.git synced 2025-12-02 21:19:24 +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

@@ -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);
}
/* ------------------------------------------------------------------------- */