diff options
author | Andrew Cagney <cagney@redhat.com> | 2004-08-10 19:37:47 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2004-08-10 19:37:47 +0000 |
commit | 4d35af46fdf6aa8de036f16ff00ee28a900daf69 (patch) | |
tree | 5edc9a44778c7eb6de59dd4b6abb19c088ece3df /gdb/utils.c | |
parent | 0b585b2efc64b09f056e29507ab26f754d169795 (diff) | |
download | gdb-4d35af46fdf6aa8de036f16ff00ee28a900daf69.tar.gz |
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.c | 46 |
1 files changed, 14 insertions, 32 deletions
diff --git a/gdb/utils.c b/gdb/utils.c index aea58f04b01..3552b8d4559 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; |