mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-15 07:13:02 +00:00
Use the more standard files xalloc.h' and xmalloc.c' instead of
Bison's `allocate.c' and `alloc.h'. This patch was surprisingly difficult and introduced a lot of core dump. It turns out that Bison used an implementation of `xmalloc' based on `calloc', and at various places it does depend upon the initialization to 0. I have not tried to isolate the pertinent places, and all the former calls to Bison's `xmalloc' are now using `XCALLOC'. Someday, someone should address this issue. * src/allocate.c, src/alloc.h, m4/bison-decl.m4: Remove. * lib/xmalloc.c, lib/xalloc.h, m4/malloc.m4, m4/realloc.m4: New files. Adjust dependencies. * src/warshall.h: New file. Propagate.
This commit is contained in:
10
src/files.c
10
src/files.c
@@ -43,7 +43,7 @@
|
||||
|
||||
#include "getargs.h"
|
||||
#include "files.h"
|
||||
#include "alloc.h"
|
||||
#include "xalloc.h"
|
||||
#include "gram.h"
|
||||
#include "complain.h"
|
||||
|
||||
@@ -90,7 +90,7 @@ stringappend (const char *string1, int end1, const char *string2)
|
||||
while (*cp1++)
|
||||
i++;
|
||||
|
||||
ostring = NEW2 (i + end1 + 1, char);
|
||||
ostring = XCALLOC (char, i + end1 + 1);
|
||||
|
||||
cp = ostring;
|
||||
cp1 = string1;
|
||||
@@ -213,7 +213,7 @@ open_files (void)
|
||||
short_base_length = strlen (spec_file_prefix);
|
||||
/* Count room for `.tab'. */
|
||||
base_length = short_base_length + 4;
|
||||
name_base = (char *) xmalloc (base_length + 1);
|
||||
name_base = XMALLOC (char, base_length + 1);
|
||||
/* Append `.tab'. */
|
||||
strcpy (name_base, spec_file_prefix);
|
||||
#ifdef VMS
|
||||
@@ -263,7 +263,7 @@ open_files (void)
|
||||
cp = getenv ("INIT");
|
||||
if (filename == 0 && cp != NULL)
|
||||
{
|
||||
filename = xmalloc (strlen (cp) + strlen (PFILE) + 2);
|
||||
filename = XMALLOC (char, strlen (cp) + strlen (PFILE) + 2);
|
||||
strcpy (filename, cp);
|
||||
cp = filename + strlen (filename);
|
||||
*cp++ = '/';
|
||||
@@ -372,7 +372,7 @@ open_extra_files (void)
|
||||
cp = getenv ("INIT");
|
||||
if (filename == 0 && cp != NULL)
|
||||
{
|
||||
filename = xmalloc (strlen (cp) + strlen (PFILE1) + 2);
|
||||
filename = XMALLOC (char, strlen (cp) + strlen (PFILE1) + 2);
|
||||
strcpy (filename, cp);
|
||||
cp = filename + strlen (filename);
|
||||
*cp++ = '/';
|
||||
|
||||
Reference in New Issue
Block a user