2004-08-10 Andrew Cagney <cagney@gnu.org>

* defs.h (xmfree): Delete.
	* utils.c (xmfree): Delete function.
	(xfree): Inline calls to xmfree and mfree.
	* symmisc.c (free_symtab_block, free_symtab): Use xfree.
	* symfile.c (reread_symbols, init_psymbol_list): Ditto.
	* source.c (forget_cached_source_info, find_and_open_source): Ditto.
	* somread.c (som_symfile_finish): Ditto.
	* objfiles.c (allocate_objfile, free_objfile):
	* nlmread.c (nlm_symfile_finish): Ditto.
	* hpread.c (hpread_symfile_finish): Ditto.
	* elfread.c (free_elfinfo, elf_symfile_finish): Ditto.
	* dbxread.c (dbx_symfile_finish, free_bincl_list): Ditto.
	* coffread.c (coff_symfile_finish): Ditto.
This commit is contained in:
Andrew Cagney 2004-08-10 21:52:05 +00:00
parent aa2ee5f640
commit 2dc74dc121
13 changed files with 45 additions and 41 deletions

View file

@ -1,5 +1,19 @@
2004-08-10 Andrew Cagney <cagney@gnu.org>
* defs.h (xmfree): Delete.
* utils.c (xmfree): Delete function.
(xfree): Inline calls to xmfree and mfree.
* symmisc.c (free_symtab_block, free_symtab): Use xfree.
* symfile.c (reread_symbols, init_psymbol_list): Ditto.
* source.c (forget_cached_source_info, find_and_open_source): Ditto.
* somread.c (som_symfile_finish): Ditto.
* objfiles.c (allocate_objfile, free_objfile):
* nlmread.c (nlm_symfile_finish): Ditto.
* hpread.c (hpread_symfile_finish): Ditto.
* elfread.c (free_elfinfo, elf_symfile_finish): Ditto.
* dbxread.c (dbx_symfile_finish, free_bincl_list): Ditto.
* coffread.c (coff_symfile_finish): Ditto.
* defs.h (xmcalloc): Delete declaration.
* utils.c (xmcalloc): Delete.
(xcalloc): Inline calls to xmcalloc and mcalloc.

View file

@ -661,7 +661,7 @@ coff_symfile_finish (struct objfile *objfile)
{
if (objfile->sym_private != NULL)
{
xmfree (objfile->md, objfile->sym_private);
xfree (objfile->sym_private);
}
/* Let stabs reader clean up */

View file

@ -748,7 +748,7 @@ dbx_symfile_finish (struct objfile *objfile)
}
xfree (hfiles);
}
xmfree (objfile->md, objfile->sym_stab_info);
xfree (objfile->sym_stab_info);
}
free_header_files ();
}
@ -937,7 +937,7 @@ find_corresponding_bincl_psymtab (char *name, int instance)
static void
free_bincl_list (struct objfile *objfile)
{
xmfree (objfile->md, bincl_list);
xfree (bincl_list);
bincls_allocated = 0;
}

View file

@ -873,10 +873,6 @@ extern char *msavestring (void *, const char *, size_t);
extern char *mstrsave (void *, const char *);
/* Robust versions of same. Throw an internal error when no memory,
guard against stray NULL arguments. */
extern void xmfree (void *md, void *ptr);
/* xmalloc(), xrealloc() and xcalloc() have already been declared in
"libiberty.h". */
extern void xfree (void *);

View file

@ -608,7 +608,7 @@ free_elfinfo (void *objp)
while (ssi)
{
nssi = ssi->next;
xmfree (objfile->md, ssi);
xfree (ssi);
ssi = nssi;
}
@ -639,7 +639,7 @@ elf_symfile_finish (struct objfile *objfile)
{
if (objfile->sym_stab_info != NULL)
{
xmfree (objfile->md, objfile->sym_stab_info);
xfree (objfile->sym_stab_info);
}
}

View file

@ -2286,7 +2286,7 @@ hpread_symfile_finish (struct objfile *objfile)
{
if (objfile->sym_private != NULL)
{
xmfree (objfile->md, objfile->sym_private);
xfree (objfile->sym_private);
}
}

View file

@ -224,7 +224,7 @@ nlm_symfile_finish (struct objfile *objfile)
{
if (objfile->sym_private != NULL)
{
xmfree (objfile->md, objfile->sym_private);
xfree (objfile->sym_private);
}
}

View file

@ -180,7 +180,7 @@ allocate_objfile (bfd *abfd, int flags)
objfile->obfd = abfd;
if (objfile->name != NULL)
{
xmfree (objfile->md, objfile->name);
xfree (objfile->name);
}
if (abfd != NULL)
{
@ -443,19 +443,19 @@ free_objfile (struct objfile *objfile)
objfile_free_data (objfile);
if (objfile->name != NULL)
{
xmfree (objfile->md, objfile->name);
xfree (objfile->name);
}
if (objfile->global_psymbols.list)
xmfree (objfile->md, objfile->global_psymbols.list);
xfree (objfile->global_psymbols.list);
if (objfile->static_psymbols.list)
xmfree (objfile->md, objfile->static_psymbols.list);
xfree (objfile->static_psymbols.list);
/* Free the obstacks for non-reusable objfiles */
bcache_xfree (objfile->psymbol_cache);
bcache_xfree (objfile->macro_cache);
if (objfile->demangled_names_hash)
htab_delete (objfile->demangled_names_hash);
obstack_free (&objfile->objfile_obstack, 0);
xmfree (objfile->md, objfile);
xfree (objfile);
objfile = NULL;
}

View file

@ -404,7 +404,7 @@ som_symfile_finish (struct objfile *objfile)
{
if (objfile->sym_stab_info != NULL)
{
xmfree (objfile->md, objfile->sym_stab_info);
xfree (objfile->sym_stab_info);
}
hpread_symfile_finish (objfile);
}

View file

@ -325,12 +325,12 @@ forget_cached_source_info (void)
{
if (s->line_charpos != NULL)
{
xmfree (objfile->md, s->line_charpos);
xfree (s->line_charpos);
s->line_charpos = NULL;
}
if (s->fullname != NULL)
{
xmfree (objfile->md, s->fullname);
xfree (s->fullname);
s->fullname = NULL;
}
}
@ -851,7 +851,7 @@ find_and_open_source (struct objfile *objfile,
if (result >= 0)
return result;
/* Didn't work -- free old one, try again. */
xmfree (objfile->md, *fullname);
xfree (*fullname);
*fullname = NULL;
}

View file

@ -1862,11 +1862,11 @@ reread_symbols (void)
/* FIXME: Do we have to free a whole linked list, or is this
enough? */
if (objfile->global_psymbols.list)
xmfree (objfile->md, objfile->global_psymbols.list);
xfree (objfile->global_psymbols.list);
memset (&objfile->global_psymbols, 0,
sizeof (objfile->global_psymbols));
if (objfile->static_psymbols.list)
xmfree (objfile->md, objfile->static_psymbols.list);
xfree (objfile->static_psymbols.list);
memset (&objfile->static_psymbols, 0,
sizeof (objfile->static_psymbols));
@ -2690,11 +2690,11 @@ init_psymbol_list (struct objfile *objfile, int total_symbols)
if (objfile->global_psymbols.list)
{
xmfree (objfile->md, objfile->global_psymbols.list);
xfree (objfile->global_psymbols.list);
}
if (objfile->static_psymbols.list)
{
xmfree (objfile->md, objfile->static_psymbols.list);
xfree (objfile->static_psymbols.list);
}
/* Current best guess is that approximately a twentieth

View file

@ -99,12 +99,12 @@ free_symtab_block (struct objfile *objfile, struct block *b)
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
xmfree (objfile->md, DEPRECATED_SYMBOL_NAME (sym));
xmfree (objfile->md, sym);
xfree (DEPRECATED_SYMBOL_NAME (sym));
xfree (sym);
}
dict_free (BLOCK_DICT (b));
xmfree (objfile->md, b);
xfree (b);
}
/* Free all the storage associated with the struct symtab <- S.
@ -138,7 +138,7 @@ free_symtab (struct symtab *s)
for (i = 0; i < n; i++)
free_symtab_block (s->objfile, BLOCKVECTOR_BLOCK (bv, i));
/* Free the blockvector itself. */
xmfree (s->objfile->md, bv);
xfree (bv);
/* Also free the linetable. */
case free_linetable:
@ -146,7 +146,7 @@ free_symtab (struct symtab *s)
or by some other symtab, except for our linetable.
Free that now. */
if (LINETABLE (s))
xmfree (s->objfile->md, LINETABLE (s));
xfree (LINETABLE (s));
break;
}
@ -156,12 +156,12 @@ free_symtab (struct symtab *s)
/* Free source-related stuff */
if (s->line_charpos != NULL)
xmfree (s->objfile->md, s->line_charpos);
xfree (s->line_charpos);
if (s->fullname != NULL)
xmfree (s->objfile->md, s->fullname);
xfree (s->fullname);
if (s->debugformat != NULL)
xmfree (s->objfile->md, s->debugformat);
xmfree (s->objfile->md, s);
xfree (s->debugformat);
xfree (s);
}
void

View file

@ -1037,13 +1037,6 @@ nomem (long size)
}
}
void
xmfree (void *md, void *ptr)
{
if (ptr != NULL)
mfree (md, ptr);
}
/* The xmalloc() (libiberty.h) family of memory management routines.
These are like the ISO-C malloc() family except that they implement
@ -1113,7 +1106,8 @@ xcalloc (size_t number, size_t size)
void
xfree (void *ptr)
{
xmfree (NULL, ptr);
if (ptr != NULL)
free (ptr); /* OK: free */
}