diff options
author | David MacKenzie <djm@cygnus> | 1994-02-05 02:46:12 +0000 |
---|---|---|
committer | David MacKenzie <djm@cygnus> | 1994-02-05 02:46:12 +0000 |
commit | 0ee3427297272a636e7ef8378182a38d64ed7b7d (patch) | |
tree | 4aad622fe6694ef2d197613a4c15a17d349507ee /bfd/libbfd.c | |
parent | 0b2f8d2edd598eb8f013e8b61fd49def1d908281 (diff) | |
download | gdb-0ee3427297272a636e7ef8378182a38d64ed7b7d.zip gdb-0ee3427297272a636e7ef8378182a38d64ed7b7d.tar.gz gdb-0ee3427297272a636e7ef8378182a38d64ed7b7d.tar.bz2 |
* libbfd.c (bfd_zmalloc): Call bfd_xmalloc instead of malloc.
(bfd_xmalloc, bfd_xmalloc_by_size_t): Functions deleted.
* libbfd-in.h: Define them as macros calling xmalloc and declare
xmalloc.
* libbfd.h: Rebuilt.
* ecofflink.c hash.c ieee.c opncls.c (obstack_chunk_alloc): Define
to be xmalloc, not bfd_xmalloc_by_size_t.
Diffstat (limited to 'bfd/libbfd.c')
-rw-r--r-- | bfd/libbfd.c | 55 |
1 files changed, 2 insertions, 53 deletions
diff --git a/bfd/libbfd.c b/bfd/libbfd.c index 0d6b5fc..29ebd09 100644 --- a/bfd/libbfd.c +++ b/bfd/libbfd.c @@ -132,65 +132,14 @@ char * bfd_zmalloc (size) bfd_size_type size; { - char *ptr = (char *) malloc ((size_t)size); + char *ptr = (char *) bfd_xmalloc (size); - if ((ptr != NULL) && (size != 0)) + if (size != 0) memset(ptr,0, (size_t) size); return ptr; } #endif /* bfd_zmalloc */ - -/* -INTERNAL_FUNCTION - bfd_xmalloc - -SYNOPSIS - PTR bfd_xmalloc (bfd_size_type size); - -DESCRIPTION - Like <<malloc>>, but exit if no more memory. - -*/ - -/** There is major inconsistency in how running out of memory is handled. - Some routines return a NULL, and set bfd_error to no_memory. - However, obstack routines can't do this ... */ - - -PTR -bfd_xmalloc (size) - bfd_size_type size; -{ - static CONST char no_memory_message[] = "Virtual memory exhausted!\n"; - PTR ptr; - if (size == 0) size = 1; - ptr = (PTR)malloc((size_t) size); - if (!ptr) - { - write (2, no_memory_message, sizeof(no_memory_message)-1); - exit (1); - } - return ptr; -} - -/* -INTERNAL_FUNCTION - bfd_xmalloc_by_size_t - -SYNOPSIS - PTR bfd_xmalloc_by_size_t (size_t size); - -DESCRIPTION - Like <<malloc>>, but exit if no more memory. - Uses <<size_t>>, so it's suitable for use as <<obstack_chunk_alloc>>. - */ -PTR -bfd_xmalloc_by_size_t (size) - size_t size; -{ - return bfd_xmalloc ((bfd_size_type) size); -} /* Some IO code */ |