aboutsummaryrefslogtreecommitdiff
path: root/gdb/utils.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2004-08-10 19:37:47 +0000
committerAndrew Cagney <cagney@redhat.com>2004-08-10 19:37:47 +0000
commit7936743b083af802de53a9483c450d917e991d46 (patch)
tree308c3878dd6db1628a33e4c990a67cf68cd842a8 /gdb/utils.c
parent902f2ccb3d3c265dfd20a64f35839df9a6c7655a (diff)
downloadgdb-7936743b083af802de53a9483c450d917e991d46.zip
gdb-7936743b083af802de53a9483c450d917e991d46.tar.gz
gdb-7936743b083af802de53a9483c450d917e991d46.tar.bz2
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.
Diffstat (limited to 'gdb/utils.c')
-rw-r--r--gdb/utils.c46
1 files changed, 14 insertions, 32 deletions
diff --git a/gdb/utils.c b/gdb/utils.c
index aea58f0..3552b8d 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -1037,33 +1037,6 @@ nomem (long size)
}
}
-/* 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)
{
@@ -1115,9 +1088,7 @@ xmfree (void *md, void *ptr)
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. */
@@ -1125,7 +1096,18 @@ xmfree (void *md, void *ptr)
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 */
@@ -1230,7 +1212,7 @@ savestring (const char *ptr, size_t size)
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;