aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2004-08-10 21:52:05 +0000
committerAndrew Cagney <cagney@redhat.com>2004-08-10 21:52:05 +0000
commit2dc74dc1214738c22fc033d9d32eb8b4059bdba2 (patch)
tree7972274ddfa63de8b40654a06bb67e1160d224e6
parentaa2ee5f640b5705d29a7c4f37b3abbfd30a08620 (diff)
downloadgdb-2dc74dc1214738c22fc033d9d32eb8b4059bdba2.zip
gdb-2dc74dc1214738c22fc033d9d32eb8b4059bdba2.tar.gz
gdb-2dc74dc1214738c22fc033d9d32eb8b4059bdba2.tar.bz2
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.
-rw-r--r--gdb/ChangeLog14
-rw-r--r--gdb/coffread.c2
-rw-r--r--gdb/dbxread.c4
-rw-r--r--gdb/defs.h4
-rw-r--r--gdb/elfread.c4
-rw-r--r--gdb/hpread.c2
-rw-r--r--gdb/nlmread.c2
-rw-r--r--gdb/objfiles.c10
-rw-r--r--gdb/somread.c2
-rw-r--r--gdb/source.c6
-rw-r--r--gdb/symfile.c8
-rw-r--r--gdb/symmisc.c18
-rw-r--r--gdb/utils.c10
13 files changed, 45 insertions, 41 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9192d67..9043fff 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 1c31d0f..2f6790e 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -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 */
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 28b0d6b..e537744 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -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;
}
diff --git a/gdb/defs.h b/gdb/defs.h
index c91fd6b..3f6e720 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -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 *);
diff --git a/gdb/elfread.c b/gdb/elfread.c
index a9f4e17..3aa2f66 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -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);
}
}
diff --git a/gdb/hpread.c b/gdb/hpread.c
index 70070d8..de1670a 100644
--- a/gdb/hpread.c
+++ b/gdb/hpread.c
@@ -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);
}
}
diff --git a/gdb/nlmread.c b/gdb/nlmread.c
index 4e9c87d..e75486e 100644
--- a/gdb/nlmread.c
+++ b/gdb/nlmread.c
@@ -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);
}
}
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 48d6954..cc6a1e1 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -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;
}
diff --git a/gdb/somread.c b/gdb/somread.c
index 13b5209..560eb88 100644
--- a/gdb/somread.c
+++ b/gdb/somread.c
@@ -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);
}
diff --git a/gdb/source.c b/gdb/source.c
index a55bd33..b1e9c3874 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -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;
}
diff --git a/gdb/symfile.c b/gdb/symfile.c
index f203ba0..d0ec083 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -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
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 1d8cdc7..45e2a44 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -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
diff --git a/gdb/utils.c b/gdb/utils.c
index e903aa8..25fca5a 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -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 */
}