* utils.c (xmmalloc): Delete.
(xmalloc): Inline xmmalloc and mmalloc calls.
(msavestring): Use xmalloc.
* defs.h (xmmalloc): Delete declaration.
* xcoffread.c (xcoff_symfile_init): Use xmalloc instead of
xmmalloc.
* symmisc.c (extend_psymbol_list): Ditto.
* symfile.c (init_psymbol_list): Ditto.
* source.c (find_source_lines): Ditto.
* hpread.c (hpread_symfile_init, hpread_lookup_type): Ditto.
* elfread.c (elf_symtab_read): Ditto.
* dbxread.c (dbx_symfile_init, init_bincl_list): Ditto.
* coffread.c (coff_symfile_init): Ditto.
+2004-08-10 Andrew Cagney <cagney@gnu.org>
+
+ * utils.c (xmmalloc): Delete.
+ (xmalloc): Inline xmmalloc and mmalloc calls.
+ (msavestring): Use xmalloc.
+ * defs.h (xmmalloc): Delete declaration.
+ * xcoffread.c (xcoff_symfile_init): Use xmalloc instead of
+ xmmalloc.
+ * symmisc.c (extend_psymbol_list): Ditto.
+ * symfile.c (init_psymbol_list): Ditto.
+ * source.c (find_source_lines): Ditto.
+ * hpread.c (hpread_symfile_init, hpread_lookup_type): Ditto.
+ * elfread.c (elf_symtab_read): Ditto.
+ * dbxread.c (dbx_symfile_init, init_bincl_list): Ditto.
+ * coffread.c (coff_symfile_init): Ditto.
+
2004-08-10 David Carlton <carlton@bactrian.org>
* MAINTAINERS: Remove David Carlton from c++ testsuite
{
/* Allocate struct to keep track of stab reading. */
objfile->sym_stab_info = (struct dbx_symfile_info *)
- xmmalloc (objfile->md, sizeof (struct dbx_symfile_info));
+ xmalloc (sizeof (struct dbx_symfile_info));
memset (objfile->sym_stab_info, 0,
sizeof (struct dbx_symfile_info));
/* Allocate struct to keep track of the symfile */
- objfile->sym_private = xmmalloc (objfile->md,
- sizeof (struct coff_symfile_info));
+ objfile->sym_private = xmalloc (sizeof (struct coff_symfile_info));
memset (objfile->sym_private, 0, sizeof (struct coff_symfile_info));
/* Allocate struct to keep track of the symfile */
objfile->sym_stab_info = (struct dbx_symfile_info *)
- xmmalloc (objfile->md, sizeof (struct dbx_symfile_info));
+ xmalloc (sizeof (struct dbx_symfile_info));
memset (objfile->sym_stab_info, 0, sizeof (struct dbx_symfile_info));
DBX_TEXT_SECTION (objfile) = bfd_get_section_by_name (sym_bfd, ".text");
{
bincls_allocated = number;
next_bincl = bincl_list = (struct header_file_location *)
- xmmalloc (objfile->md, bincls_allocated * sizeof (struct header_file_location));
+ xmalloc (bincls_allocated * sizeof (struct header_file_location));
}
/* Add a bincl to the list. */
/* Robust versions of same. Throw an internal error when no memory,
guard against stray NULL arguments. */
-extern void *xmmalloc (void *md, size_t size);
extern void *xmrealloc (void *md, void *ptr, size_t size);
extern void *xmcalloc (void *md, size_t number, size_t size);
extern void xmfree (void *md, void *ptr);
+ (sizeof (CORE_ADDR)
* max_index));
sectinfo = (struct stab_section_info *)
- xmmalloc (objfile->md, size);
+ xmalloc (size);
memset (sectinfo, 0, size);
sectinfo->num_sections = max_index;
if (filesym == NULL)
/* Allocate struct to keep track of the symfile */
objfile->sym_stab_info = (struct dbx_symfile_info *)
- xmmalloc (objfile->md, sizeof (struct dbx_symfile_info));
+ xmalloc (sizeof (struct dbx_symfile_info));
memset ((char *) objfile->sym_stab_info, 0, sizeof (struct dbx_symfile_info));
make_cleanup (free_elfinfo, (void *) objfile);
/* Allocate struct to keep track of the symfile */
objfile->sym_private =
- xmmalloc (objfile->md, sizeof (struct hpread_symfile_info));
+ xmalloc (sizeof (struct hpread_symfile_info));
memset (objfile->sym_private, 0, sizeof (struct hpread_symfile_info));
/* We haven't read in any types yet. */
{
DNTT_TYPE_VECTOR_LENGTH (objfile) = LNTT_SYMCOUNT (objfile) + GNTT_SYMCOUNT (objfile);
DNTT_TYPE_VECTOR (objfile) = (struct type **)
- xmmalloc (objfile->md, DNTT_TYPE_VECTOR_LENGTH (objfile) * sizeof (struct type *));
+ xmalloc (DNTT_TYPE_VECTOR_LENGTH (objfile) * sizeof (struct type *));
memset (&DNTT_TYPE_VECTOR (objfile)[old_len], 0,
(DNTT_TYPE_VECTOR_LENGTH (objfile) - old_len) *
sizeof (struct type *));
long mtime = 0;
int size;
- line_charpos = (int *) xmmalloc (s->objfile->md,
- lines_allocated * sizeof (int));
+ line_charpos = (int *) xmalloc (lines_allocated * sizeof (int));
if (fstat (desc, &st) < 0)
perror_with_name (s->filename);
{
objfile->global_psymbols.next =
objfile->global_psymbols.list = (struct partial_symbol **)
- xmmalloc (objfile->md, (objfile->global_psymbols.size
- * sizeof (struct partial_symbol *)));
+ xmalloc ((objfile->global_psymbols.size
+ * sizeof (struct partial_symbol *)));
}
if (objfile->static_psymbols.size > 0)
{
objfile->static_psymbols.next =
objfile->static_psymbols.list = (struct partial_symbol **)
- xmmalloc (objfile->md, (objfile->static_psymbols.size
- * sizeof (struct partial_symbol *)));
+ xmalloc ((objfile->static_psymbols.size
+ * sizeof (struct partial_symbol *)));
}
}
{
new_size = 255;
listp->list = (struct partial_symbol **)
- xmmalloc (objfile->md, new_size * sizeof (struct partial_symbol *));
+ xmalloc (new_size * sizeof (struct partial_symbol *));
}
else
{
}
}
-/* The xmmalloc() family of memory management routines.
-
- These are are like the mmalloc() family except that they implement
- consistent semantics and guard against typical memory management
- problems: if a malloc fails, an internal error is thrown; if
- free(NULL) is called, it is ignored; if *alloc(0) is called, NULL
- is returned.
-
- All these routines are implemented using the mmalloc() family. */
-
-void *
-xmmalloc (void *md, size_t size)
-{
- void *val;
-
- /* See libiberty/xmalloc.c. This function need's to match that's
- semantics. It never returns NULL. */
- if (size == 0)
- size = 1;
-
- val = mmalloc (md, size);
- if (val == NULL)
- nomem (size);
-
- return (val);
-}
-
void *
xmrealloc (void *md, void *ptr, size_t size)
{
These are like the ISO-C malloc() family except that they implement
consistent semantics and guard against typical memory management
- problems. See xmmalloc() above for further information.
-
- All these routines are wrappers to the xmmalloc() family. */
+ problems. */
/* NOTE: These are declared using PTR to ensure consistency with
"libiberty.h". xfree() is GDB local. */
PTR /* OK: PTR */
xmalloc (size_t size)
{
- return xmmalloc (NULL, size);
+ void *val;
+
+ /* See libiberty/xmalloc.c. This function need's to match that's
+ semantics. It never returns NULL. */
+ if (size == 0)
+ size = 1;
+
+ val = malloc (size); /* OK: malloc */
+ if (val == NULL)
+ nomem (size);
+
+ return (val);
}
PTR /* OK: PTR */
char *
msavestring (void *md, const char *ptr, size_t size)
{
- char *p = (char *) xmmalloc (md, size + 1);
+ char *p = (char *) xmalloc (size + 1);
memcpy (p, ptr, size);
p[size] = 0;
return p;
xcoff_symfile_init (struct objfile *objfile)
{
/* Allocate struct to keep track of the symfile */
- objfile->sym_private = xmmalloc (objfile->md,
- sizeof (struct coff_symfile_info));
+ objfile->sym_private = xmalloc (sizeof (struct coff_symfile_info));
/* XCOFF objects may be reordered, so set OBJF_REORDERED. If we
find this causes a significant slowdown in gdb then we could