+Mon Feb 12 13:11:32 1996 Fred Fish <fnf@cygnus.com>
+
+ * f-lang.c (allocate_saved_bf_node, allocate_saved_function_node,
+ allocate_saved_f77_common_node, allocate_common_entry_node,
+ add_common_block): Use xmalloc rather than malloc, some of which
+ were unchecked.
+ * gnu-regex.c: At same point as other gdb specific changes
+ #undef malloc and then #define it to xmalloc.
+ * ch-exp.c (growbuf_by_size): Use xmalloc/xrealloc rather than
+ bare unchecked calls to malloc/realloc.
+ * stabsread.c (dbx_lookup_type): Use xmalloc rather than bare
+ unchecked call to malloc.
+
Wed Feb 7 11:31:26 1996 Stu Grossman (grossman@cygnus.com)
* symtab.c (gdb_mangle_name): Change opname var to be const to
during the process of parsing; the lower levels of the tree always
come first in the result.
- Note that malloc's and realloc's in this file are transformed to
- xmalloc and xrealloc respectively by the same sed command in the
- makefile that remaps any other malloc/realloc inserted by the parser
- generator. Doing this with #defines and trying to control the interaction
- with include files (<malloc.h> and <stdlib.h> for example) just became
- too messy, particularly when such includes can be inserted at random
- times by the parser generator.
-
- Also note that the language accepted by this parser is more liberal
+ Note that the language accepted by this parser is more liberal
than the one accepted by an actual Chill compiler. For example, the
language rule that a simple name string can not be one of the reserved
simple name strings is not enforced (e.g "case" is not treated as a
tempbufsize += growby;
if (tempbuf == NULL)
{
- tempbuf = (char *) malloc (tempbufsize);
+ tempbuf = (char *) xmalloc (tempbufsize);
}
else
{
- tempbuf = (char *) realloc (tempbuf, tempbufsize);
+ tempbuf = (char *) xrealloc (tempbuf, tempbufsize);
}
}
{
SAVED_BF_PTR new;
- new = (SAVED_BF_PTR) malloc (sizeof (SAVED_BF));
-
- if (new == NULL)
- fatal("could not allocate enough memory to save one more .bf on save list");
+ new = (SAVED_BF_PTR) xmalloc (sizeof (SAVED_BF));
return(new);
}
{
SAVED_FUNCTION *new;
- new = (SAVED_FUNCTION *) malloc (sizeof (SAVED_FUNCTION));
-
- if (new == NULL)
- fatal("could not allocate enough memory to save one more function on save list");
-
+ new = (SAVED_FUNCTION *) xmalloc (sizeof (SAVED_FUNCTION));
return(new);
}
{
SAVED_F77_COMMON_PTR new;
- new = (SAVED_F77_COMMON_PTR) malloc (sizeof (SAVED_F77_COMMON));
-
- if (new == NULL)
- fatal("could not allocate enough memory to save one more F77 COMMON blk on save list");
-
+ new = (SAVED_F77_COMMON_PTR) xmalloc (sizeof (SAVED_F77_COMMON));
return(new);
}
{
COMMON_ENTRY_PTR new;
- new = (COMMON_ENTRY_PTR) malloc (sizeof (COMMON_ENTRY));
-
- if (new == NULL)
- fatal("could not allocate enough memory to save one more COMMON entry on save list");
-
+ new = (COMMON_ENTRY_PTR) xmalloc (sizeof (COMMON_ENTRY));
return(new);
}
tmp = allocate_saved_f77_common_node();
- local_copy_func_stab = malloc (strlen(func_stab) + 1);
+ local_copy_func_stab = xmalloc (strlen(func_stab) + 1);
strcpy(local_copy_func_stab,func_stab);
- tmp->name = malloc(strlen(name) + 1);
+ tmp->name = xmalloc(strlen(name) + 1);
/* local_copy_func_stab is a stabstring, let us first extract the
function name from the stab by NULLing out the ':' character. */
error("Malformed function STAB found in add_common_block()");
- tmp->owning_function = malloc (strlen(local_copy_func_stab) + 1);
+ tmp->owning_function = xmalloc (strlen(local_copy_func_stab) + 1);
strcpy(tmp->owning_function,local_copy_func_stab);
#include "defs.h"
#include "gdb_string.h"
+#undef malloc
+#define malloc xmalloc
/*
* Define the syntax stuff, so we can do the \<...\> things.
{
type_vector_length = INITIAL_TYPE_VECTOR_LENGTH;
type_vector = (struct type **)
- malloc (type_vector_length * sizeof (struct type *));
+ xmalloc (type_vector_length * sizeof (struct type *));
}
while (index >= type_vector_length)
{